Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add weekend schedule #1172

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions uni/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 2 additions & 0 deletions uni/lib/generated/intl/messages_pt_PT.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
10 changes: 10 additions & 0 deletions uni/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions uni/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions uni/lib/l10n/intl_pt_PT.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 9 additions & 5 deletions uni/lib/view/schedule/schedule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ class SchedulePageViewState extends State<SchedulePageView>
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);
}

Expand All @@ -82,7 +82,7 @@ class SchedulePageViewState extends State<SchedulePageView>
Expanded(
child: TabBarView(
controller: tabController,
children: Iterable<int>.generate(5).map((day) {
children: Iterable<int>.generate(6).map((day) {
final lectures = lecturesOfDay(widget.lectures, day);
if (lectures.isEmpty) {
return emptyDayColumn(context, day);
Expand All @@ -100,7 +100,7 @@ class SchedulePageViewState extends State<SchedulePageView>
List<Widget> createTabs(MediaQueryData queryData, BuildContext context) {
final tabs = <Widget>[];
final workWeekDays =
context.read<LocaleNotifier>().getWeekdaysWithLocale().sublist(0, 5);
context.read<LocaleNotifier>().getWeekdaysWithLocale().sublist(0, 6);
workWeekDays.asMap().forEach((index, day) {
tabs.add(
SizedBox(
Expand Down Expand Up @@ -158,10 +158,14 @@ class SchedulePageViewState extends State<SchedulePageView>
final weekday =
Provider.of<LocaleNotifier>(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),
),
);
Expand Down
2 changes: 0 additions & 2 deletions uni/test/unit/view/Pages/exams_page_view_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
Loading