From cb2581b3724b213b8e8da9a52a60e73bd7a69142 Mon Sep 17 00:00:00 2001 From: Armand <4831c0@proton.me> Date: Tue, 2 Sep 2025 13:01:09 +0200 Subject: [PATCH] tt_mo: fix student presence N/A showing up as missing --- .../ui/phone/pages/home/home_timetable.dart | 299 +++++++++--------- .../phone/pages/home/home_timetable_mo.dart | 3 + 2 files changed, 153 insertions(+), 149 deletions(-) diff --git a/firka/lib/ui/phone/pages/home/home_timetable.dart b/firka/lib/ui/phone/pages/home/home_timetable.dart index 25644e7..240288f 100644 --- a/firka/lib/ui/phone/pages/home/home_timetable.dart +++ b/firka/lib/ui/phone/pages/home/home_timetable.dart @@ -170,46 +170,47 @@ class _HomeTimetableScreen extends State { } return Scaffold( - backgroundColor: appStyle.colors.background, body: - Stack(children: [ - SizedBox( - width: MediaQuery.of(context).size.width, - height: 74 + 16, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + backgroundColor: appStyle.colors.background, + body: Stack(children: [ + SizedBox( + width: MediaQuery.of(context).size.width, + height: 74 + 16, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( children: [ - Text( - widget.data.l10n.timetable, - style: appStyle.fonts.H_H2 - .apply(color: appStyle.colors.textPrimary), - ), Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - /* TODO: 1.1.0 - GestureDetector( - child: Card( - color: appStyle.colors.buttonSecondaryFill, - child: Padding( - padding: const EdgeInsets.all(8), - child: FirkaIconWidget( - FirkaIconType.majesticons, - Majesticon.tableSolid, - size: 26.0, - color: appStyle.colors.accent, - ), - ), - ), - onTap: () { - widget.pageController(1); - }, + Text( + widget.data.l10n.timetable, + style: appStyle.fonts.H_H2 + .apply(color: appStyle.colors.textPrimary), ), + Row( + children: [ + GestureDetector( + child: Card( + color: appStyle.colors.buttonSecondaryFill, + child: Padding( + padding: const EdgeInsets.all(8), + child: FirkaIconWidget( + FirkaIconType.majesticons, + Majesticon.tableSolid, + size: 26.0, + color: appStyle.colors.accent, + ), + ), + ), + onTap: () { + widget.pageController(1); + }, + ), + /* TODO: 1.1.0 + Card( color: appStyle.colors.buttonSecondaryFill, - child: Padding( TO + child: Padding( padding: const EdgeInsets.all(4), child: FirkaIconWidget( FirkaIconType.majesticons, @@ -220,129 +221,129 @@ class _HomeTimetableScreen extends State { ), ), */ - GestureDetector( - child: Card( - color: appStyle.colors.buttonSecondaryFill, - child: Padding( - padding: const EdgeInsets.all(8), - child: FirkaIconWidget( - FirkaIconType.majesticons, - Majesticon.settingsCogSolid, - size: 26.0, - color: appStyle.colors.accent, + GestureDetector( + child: Card( + color: appStyle.colors.buttonSecondaryFill, + child: Padding( + padding: const EdgeInsets.all(8), + child: FirkaIconWidget( + FirkaIconType.majesticons, + Majesticon.settingsCogSolid, + size: 26.0, + color: appStyle.colors.accent, + ), + ), ), + onTap: () { + showSettingsSheet( + context, + MediaQuery.of(context).size.height * 0.4, + widget.data, + widget.data.settings + .group("settings") + .subGroup("timetable_toast")); + }, + ) + ], + ), + ], + ), + SizedBox(height: 16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + GestureDetector( + behavior: HitTestBehavior.translucent, + child: SizedBox( + width: 24, + height: 24, + child: FirkaIconWidget( + FirkaIconType.icons, + "dropdownLeft", + size: 24, + color: appStyle.colors.accent, ), ), - onTap: () { - showSettingsSheet( - context, - MediaQuery.of(context).size.height * 0.4, - widget.data, - widget.data.settings - .group("settings") - .subGroup("timetable_toast")); + onTap: () async { + var newNow = now!.subtract(Duration(days: 7)); + setState(() { + now = newNow; + lessons = null; + dates = null; + }); + await initForWeek(newNow); + setState(() { + now = newNow; + }); }, - ) + ), + Row( + children: [ + Text( + now!.format( + widget.data.l10n, FormatMode.yyyymmddwedd), + style: appStyle.fonts.B_14R), + SizedBox(width: 4), + Text("•", + style: appStyle.fonts.B_16R + .apply(color: appStyle.colors.accent)), + SizedBox(width: 4), + Text( + now!.isAWeek() + ? widget.data.l10n.a_week + : widget.data.l10n.b_week, + style: appStyle.fonts.B_14R), + ], + ), + GestureDetector( + child: FirkaIconWidget( + FirkaIconType.icons, + "dropdownRight", + size: 24, + color: appStyle.colors.accent, + ), + onTap: () async { + var newNow = now!.add(Duration(days: 7)); + await initForWeek(newNow); + setState(() { + now = newNow; + }); + }, + ), ], - ), + ) ], ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - behavior: HitTestBehavior.translucent, - child: SizedBox( - width: 24, - height: 24, - child: FirkaIconWidget( - FirkaIconType.icons, - "dropdownLeft", - size: 24, - color: appStyle.colors.accent, - ), - ), - onTap: () async { - var newNow = now!.subtract(Duration(days: 7)); - setState(() { - now = newNow; - lessons = null; - dates = null; - }); - await initForWeek(newNow); - setState(() { - now = newNow; - }); - }, - ), - Row( - children: [ - Text( - now!.format( - widget.data.l10n, FormatMode.yyyymmddwedd), - style: appStyle.fonts.B_14R), - SizedBox(width: 4), - Text("•", - style: appStyle.fonts.B_16R - .apply(color: appStyle.colors.accent)), - SizedBox(width: 4), - Text( - now!.isAWeek() - ? widget.data.l10n.a_week - : widget.data.l10n.b_week, - style: appStyle.fonts.B_14R), - ], - ), - GestureDetector( - child: FirkaIconWidget( - FirkaIconType.icons, - "dropdownRight", - size: 24, - color: appStyle.colors.accent, - ), - onTap: () async { - var newNow = now!.add(Duration(days: 7)); - await initForWeek(newNow); - setState(() { - now = newNow; - }); - }, - ), - ], - ) - ], + ), ), - ), - ), - Column( - children: [ - TransparentPointer( - child: SizedBox( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height / 1.4, - child: CarouselSlider( - items: ttDays, - carouselController: _controller, - options: CarouselOptions( - height: MediaQuery.of(context).size.height / 1.36, - viewportFraction: 1, - enableInfiniteScroll: false, - initialPage: active, - onPageChanged: (i, _) { - setState(() { - active = i; - }); - }), - ))), - TransparentPointer( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: ttWidgets, - )), - ], - ) - ])); + Column( + children: [ + TransparentPointer( + child: SizedBox( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height / 1.4, + child: CarouselSlider( + items: ttDays, + carouselController: _controller, + options: CarouselOptions( + height: MediaQuery.of(context).size.height / 1.36, + viewportFraction: 1, + enableInfiniteScroll: false, + initialPage: active, + onPageChanged: (i, _) { + setState(() { + active = i; + }); + }), + ))), + TransparentPointer( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: ttWidgets, + )), + ], + ) + ])); } else { return SizedBox( height: MediaQuery.of(context).size.height / 1.35, diff --git a/firka/lib/ui/phone/pages/home/home_timetable_mo.dart b/firka/lib/ui/phone/pages/home/home_timetable_mo.dart index f2c772a..35afef0 100644 --- a/firka/lib/ui/phone/pages/home/home_timetable_mo.dart +++ b/firka/lib/ui/phone/pages/home/home_timetable_mo.dart @@ -152,6 +152,7 @@ class _HomeTimetableMonthlyScreen extends State { var omissionType = lessonsToday.firstWhereOrNull((lesson) => lesson.studentPresence != null && + lesson.studentPresence?.name != OmissionConsts.na && lesson.studentPresence?.name != OmissionConsts.present); switch (activeFilter) { @@ -471,6 +472,8 @@ class _HomeTimetableMonthlyScreen extends State { .isAfter(currentMonthStart) && lesson.end.isBefore(currentMonthEnd) && lesson.studentPresence != null && + lesson.studentPresence?.name != + OmissionConsts.na && lesson.studentPresence?.name != OmissionConsts.present) .length,