diff --git a/trainerbox/lib/screens/calendar_tab.dart b/trainerbox/lib/screens/calendar_tab.dart index 659d45a..6ea45bb 100644 --- a/trainerbox/lib/screens/calendar_tab.dart +++ b/trainerbox/lib/screens/calendar_tab.dart @@ -201,8 +201,8 @@ class _CalendarTabState extends State { final timeParts = (timeStr as String).split(':'); if (timeParts.length != 2) return; - final hour = int.tryParse(timeParts[0]) ?? 0; - final minute = int.tryParse(timeParts[1]) ?? 0; + //final hour = int.tryParse(timeParts[0]) ?? 0; + //final minute = int.tryParse(timeParts[1]) ?? 0; final duration = trainingDurations[day] ?? 60; final targetWeekday = weekdays[day] ?? 1; @@ -391,7 +391,7 @@ class _CalendarTabState extends State { ), ], ), - ) ?? false; + ); //?? false; } } } @@ -512,7 +512,7 @@ class _CalendarTabState extends State { if (trainingId != null && trainingId.startsWith('weekly_')) { // Füge das Datum zu cancelledTrainings hinzu, wenn es noch nicht existiert if (!cancelledTrainings.any((cancelled) => - cancelled is Map && + //cancelled is Map && cancelled['date'] == dateString )) { cancelledTrainings.add({ @@ -552,7 +552,7 @@ class _CalendarTabState extends State { // Wenn an diesem Tag kein regelmäßiges Training stattfindet, entferne den Eintrag aus cancelledTrainings if (!trainingTimes.containsKey(weekdayName)) { cancelledTrainings.removeWhere((cancelled) => - cancelled is Map && + //cancelled is Map && cancelled.containsKey('date') && cancelled['date'] == dateString ); @@ -671,25 +671,6 @@ class _CalendarTabState extends State { } } - int _getDaysUntilNext(String day, int currentWeekday) { - final weekdays = { - 'Montag': 1, - 'Dienstag': 2, - 'Mittwoch': 3, - 'Donnerstag': 4, - 'Freitag': 5, - 'Samstag': 6, - 'Sonntag': 7, - }; - - final targetWeekday = weekdays[day] ?? 1; - var daysUntilNext = targetWeekday - currentWeekday; - if (daysUntilNext <= 0) { - daysUntilNext += 7; - } - return daysUntilNext; - } - List> _getEventsForDay(DateTime day) { final normalizedDate = DateTime(day.year, day.month, day.day); return _events[normalizedDate] ?? []; @@ -1141,7 +1122,7 @@ class _CalendarTabState extends State { // Wenn an diesem Tag ein regelmäßiges Training stattfindet, füge es zu cancelledTrainings hinzu if (trainingTimes.containsKey(weekdayName)) { if (!cancelledTrainings.any((cancelled) => - cancelled is Map && + //cancelled is Map && cancelled['date'] == dateString )) { cancelledTrainings.add({ @@ -1151,7 +1132,7 @@ class _CalendarTabState extends State { } else { // Wenn kein regelmäßiges Training stattfindet, entferne den Eintrag aus cancelledTrainings cancelledTrainings.removeWhere((cancelled) => - cancelled is Map && + //cancelled is Map && cancelled.containsKey('date') && cancelled['date'] == dateString ); diff --git a/trainerbox/lib/screens/home_screen.dart b/trainerbox/lib/screens/home_screen.dart index 3a63076..793f0a0 100644 --- a/trainerbox/lib/screens/home_screen.dart +++ b/trainerbox/lib/screens/home_screen.dart @@ -76,7 +76,7 @@ class _HomeScreenState extends State { final exercisesSnapshot = await FirebaseFirestore.instance.collection('Training').get(); final allExercises = exercisesSnapshot.docs.map((doc) { - return {'id': doc.id, ...doc.data() as Map}; + return {'id': doc.id, ...doc.data()}; }).toList(); // 3. Filter for unused and highly rated exercises diff --git a/trainerbox/lib/screens/profile_tab.dart b/trainerbox/lib/screens/profile_tab.dart index 40ac2ce..0473c79 100644 --- a/trainerbox/lib/screens/profile_tab.dart +++ b/trainerbox/lib/screens/profile_tab.dart @@ -18,7 +18,7 @@ class ProfileTab extends StatefulWidget { class _ProfileTabState extends State { // Form key for validating the profile form. - final _formKey = GlobalKey(); + //final _formKey = GlobalKey(); // Indicates if the user is a trainer. bool _isTrainer = false; // Indicates if data is currently loading. @@ -157,7 +157,7 @@ class _ProfileTabState extends State { // Remove cancelledTrainings for these dates. cancelledTrainings.removeWhere((cancelled) => - cancelled is Map && + //cancelled is Map && cancelled.containsKey('date') && newTrainingDates.contains(cancelled['date']) );