From ebe3e405233dabd58bb7bb6cb43bdd26447447dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lima?= Date: Wed, 28 Feb 2024 17:08:13 +0000 Subject: [PATCH 1/3] fix: display saturday classes on schedule --- uni/lib/view/schedule/schedule.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uni/lib/view/schedule/schedule.dart b/uni/lib/view/schedule/schedule.dart index bccfe528a..b5397ed14 100644 --- a/uni/lib/view/schedule/schedule.dart +++ b/uni/lib/view/schedule/schedule.dart @@ -55,10 +55,10 @@ class SchedulePageViewState extends State super.initState(); tabController = TabController( vsync: this, - length: 5, + length: 6, ); final weekDay = DateTime.now().weekday; - final offset = (weekDay > 5) ? 0 : (weekDay - 1) % 5; + final offset = (weekDay > 6) ? 0 : (weekDay - 1) % 6; tabController?.animateTo(tabController!.index + offset); } @@ -82,7 +82,7 @@ class SchedulePageViewState extends State Expanded( child: TabBarView( controller: tabController, - children: Iterable.generate(5).map((day) { + children: Iterable.generate(6).map((day) { final lectures = lecturesOfDay(widget.lectures, day); if (lectures.isEmpty) { return emptyDayColumn(context, day); @@ -100,7 +100,7 @@ class SchedulePageViewState extends State List createTabs(MediaQueryData queryData, BuildContext context) { final tabs = []; final workWeekDays = - context.read().getWeekdaysWithLocale().sublist(0, 5); + context.read().getWeekdaysWithLocale().sublist(0, 6); workWeekDays.asMap().forEach((index, day) { tabs.add( SizedBox( From fdbe879eea886afb0f4d855f8aa4b7298edafff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lima?= Date: Thu, 29 Feb 2024 02:53:11 +0000 Subject: [PATCH 2/3] fix: use correct determinants for weekend in pt_PT --- uni/lib/generated/intl/messages_en.dart | 2 ++ uni/lib/generated/intl/messages_pt_PT.dart | 2 ++ uni/lib/generated/l10n.dart | 10 ++++++++++ uni/lib/l10n/intl_en.arb | 2 ++ uni/lib/l10n/intl_pt_PT.arb | 2 ++ uni/lib/view/schedule/schedule.dart | 6 +++++- 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/uni/lib/generated/intl/messages_en.dart b/uni/lib/generated/intl/messages_en.dart index 3508c496d..c7aef77de 100644 --- a/uni/lib/generated/intl/messages_en.dart +++ b/uni/lib/generated/intl/messages_en.dart @@ -178,6 +178,8 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("No classes to present"), "no_classes_on": MessageLookupByLibrary.simpleMessage("You don\'t have classes on"), + "no_classes_on_weekend": + MessageLookupByLibrary.simpleMessage("You don\'t have classes on"), "no_college": MessageLookupByLibrary.simpleMessage("no college"), "no_course_units": MessageLookupByLibrary.simpleMessage( "No course units in the selected period"), diff --git a/uni/lib/generated/intl/messages_pt_PT.dart b/uni/lib/generated/intl/messages_pt_PT.dart index 64053ebfd..b57f5d6dd 100644 --- a/uni/lib/generated/intl/messages_pt_PT.dart +++ b/uni/lib/generated/intl/messages_pt_PT.dart @@ -179,6 +179,8 @@ class MessageLookup extends MessageLookupByLibrary { "Não existem aulas para apresentar"), "no_classes_on": MessageLookupByLibrary.simpleMessage("Não possui aulas à"), + "no_classes_on_weekend": + MessageLookupByLibrary.simpleMessage("Não possui aulas ao"), "no_college": MessageLookupByLibrary.simpleMessage("sem faculdade"), "no_course_units": MessageLookupByLibrary.simpleMessage( "Sem cadeiras no período selecionado"), diff --git a/uni/lib/generated/l10n.dart b/uni/lib/generated/l10n.dart index 3be2a9846..fbc8cc307 100644 --- a/uni/lib/generated/l10n.dart +++ b/uni/lib/generated/l10n.dart @@ -928,6 +928,16 @@ class S { ); } + /// `You don't have classes on` + String get no_classes_on_weekend { + return Intl.message( + 'You don\'t have classes on', + name: 'no_classes_on_weekend', + desc: '', + args: [], + ); + } + /// `no college` String get no_college { return Intl.message( diff --git a/uni/lib/l10n/intl_en.arb b/uni/lib/l10n/intl_en.arb index e97e4101c..408136d18 100644 --- a/uni/lib/l10n/intl_en.arb +++ b/uni/lib/l10n/intl_en.arb @@ -180,6 +180,8 @@ "@no_classes": {}, "no_classes_on": "You don't have classes on", "@no_classes_on": {}, + "no_classes_on_weekend": "You don't have classes on", + "@no_classes_on_weekend": {}, "no_college": "no college", "@no_college": {}, "no_course_units": "No course units in the selected period", diff --git a/uni/lib/l10n/intl_pt_PT.arb b/uni/lib/l10n/intl_pt_PT.arb index a342593f3..012c4b201 100644 --- a/uni/lib/l10n/intl_pt_PT.arb +++ b/uni/lib/l10n/intl_pt_PT.arb @@ -190,6 +190,8 @@ "@no_classes": {}, "no_classes_on": "Não possui aulas à", "@no_classes_on": {}, + "no_classes_on_weekend": "Não possui aulas ao", + "@no_classes_on_weekend": {}, "no_college": "sem faculdade", "@no_college": {}, "no_course_units": "Sem cadeiras no período selecionado", diff --git a/uni/lib/view/schedule/schedule.dart b/uni/lib/view/schedule/schedule.dart index b5397ed14..bf70dc49a 100644 --- a/uni/lib/view/schedule/schedule.dart +++ b/uni/lib/view/schedule/schedule.dart @@ -158,10 +158,14 @@ class SchedulePageViewState extends State final weekday = Provider.of(context).getWeekdaysWithLocale()[day]; + final noClassesText = day >= DateTime.saturday - 1 + ? S.of(context).no_classes_on_weekend + : S.of(context).no_classes_on; + return Center( child: ImageLabel( imagePath: 'assets/images/schedule.png', - label: '${S.of(context).no_classes_on} $weekday.', + label: '$noClassesText $weekday.', labelTextStyle: const TextStyle(fontSize: 15), ), ); From a5ad0094a0614be6140bc98e33df8670e9ed9d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lima?= Date: Thu, 29 Feb 2024 08:27:59 +0000 Subject: [PATCH 3/3] test: fix tests --- uni/test/unit/view/Pages/exams_page_view_test.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/uni/test/unit/view/Pages/exams_page_view_test.dart b/uni/test/unit/view/Pages/exams_page_view_test.dart index 72439fa55..b8d52f718 100644 --- a/uni/test/unit/view/Pages/exams_page_view_test.dart +++ b/uni/test/unit/view/Pages/exams_page_view_test.dart @@ -52,8 +52,6 @@ void main() async { await tester.pumpWidget(testableWidget(widget, providers: providers)); await tester.pumpAndSettle(); - debugDumpApp(); - expect(find.byKey(Key(firstExam.toString())), findsOneWidget); expect(find.byKey(Key('$firstExam-exam')), findsOneWidget); });