Refactor ActivityCard UI and improve voting functionality
- Updated ActivityCard layout for better visual consistency and responsiveness. - Simplified the category badge and adjusted styles for better readability. - Enhanced the voting section with a progress bar and improved button designs. - Added a new method in Activity model to check if all trip participants approved an activity. - Improved error handling and validation in ActivityRepository for voting and fetching activities. - Implemented pagination in ActivityPlacesService for activity searches. - Removed outdated scripts for cleaning up duplicate images.
This commit is contained in:
@@ -67,6 +67,23 @@ class Activity {
|
||||
return votes[userId] ?? 0;
|
||||
}
|
||||
|
||||
/// Vérifie si tous les participants du voyage ont voté positivement pour cette activité
|
||||
bool isApprovedByAllParticipants(List<String> tripParticipants) {
|
||||
if (tripParticipants.isEmpty) return false;
|
||||
|
||||
// Tous les participants doivent avoir voté
|
||||
for (String participantId in tripParticipants) {
|
||||
if (!votes.containsKey(participantId)) {
|
||||
return false; // Quelqu'un n'a pas encore voté
|
||||
}
|
||||
if (votes[participantId] != 1) {
|
||||
return false; // Quelqu'un a voté négativement ou neutre
|
||||
}
|
||||
}
|
||||
|
||||
return true; // Tous ont voté positivement
|
||||
}
|
||||
|
||||
/// Crée une copie avec des modifications
|
||||
Activity copyWith({
|
||||
String? id,
|
||||
|
||||
Reference in New Issue
Block a user