things things

This commit is contained in:
Kima 2024-05-03 17:08:03 +02:00
parent f346d9b8ef
commit 0b96cd9080
3 changed files with 23 additions and 17 deletions

View File

@ -246,7 +246,7 @@ class LessonTile extends StatelessWidget {
? accent.withOpacity(.15) ? accent.withOpacity(.15)
: Theme.of(context) : Theme.of(context)
.colorScheme .colorScheme
.secondary .tertiary
.withOpacity(.15), .withOpacity(.15),
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
), ),
@ -398,7 +398,7 @@ class LessonTile extends StatelessWidget {
? accent.withOpacity(.15) ? accent.withOpacity(.15)
: Theme.of(context) : Theme.of(context)
.colorScheme .colorScheme
.secondary .tertiary
.withOpacity(.15), .withOpacity(.15),
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
), ),

View File

@ -362,6 +362,7 @@ class AbsencesPageState extends State<AbsencesPage>
List<Absence> unexcused = []; List<Absence> unexcused = [];
List<Absence> excused = []; List<Absence> excused = [];
List<Absence> pending = [];
List<double> absencePositions = []; List<double> absencePositions = [];
List<Color> finalChartColors = []; List<Color> finalChartColors = [];
@ -375,13 +376,14 @@ class AbsencesPageState extends State<AbsencesPage>
.where((e) => .where((e) =>
e.delay == 0 && e.state == Justification.excused) e.delay == 0 && e.state == Justification.excused)
.toList(); .toList();
pending = absenceProvider.absences
.where((e) =>
e.delay == 0 && e.state == Justification.pending)
.toList();
value1 = excused.length; value1 = excused.length;
value2 = unexcused.length; value2 = unexcused.length;
value3 = absenceProvider.absences value3 = pending.length;
.where((e) =>
e.delay == 0 && e.state == Justification.pending)
.length;
title1 = "stat_1".i18n; title1 = "stat_1".i18n;
title2 = "stat_2".i18n; title2 = "stat_2".i18n;
suffix = " ${"hr".i18n}"; suffix = " ${"hr".i18n}";
@ -394,15 +396,15 @@ class AbsencesPageState extends State<AbsencesPage>
.where((e) => .where((e) =>
e.delay != 0 && e.state == Justification.excused) e.delay != 0 && e.state == Justification.excused)
.toList(); .toList();
pending = absenceProvider.absences
.where((e) =>
e.delay != 0 && e.state == Justification.pending)
.toList();
value1 = excused.map((e) => e.delay).fold(0, (a, b) => a + b); value1 = excused.map((e) => e.delay).fold(0, (a, b) => a + b);
value2 = value2 =
unexcused.map((e) => e.delay).fold(0, (a, b) => a + b); unexcused.map((e) => e.delay).fold(0, (a, b) => a + b);
value3 = absenceProvider.absences value3 = pending.map((e) => e.delay).fold(0, (a, b) => a + b);
.where((e) =>
e.delay != 0 && e.state == Justification.pending)
.map((e) => e.delay)
.fold(0, (a, b) => a + b);
title1 = "stat_3".i18n; title1 = "stat_3".i18n;
title2 = "stat_4".i18n; title2 = "stat_4".i18n;
suffix = " ${"min".i18n}"; suffix = " ${"min".i18n}";
@ -417,7 +419,7 @@ class AbsencesPageState extends State<AbsencesPage>
int barTotal = int barTotal =
DateTime.now().difference(DateTime(yr, 09, 01)).inDays; DateTime.now().difference(DateTime(yr, 09, 01)).inDays;
[...unexcused, ...excused].forEachIndexed((i, a) { [...unexcused, ...excused, ...pending].forEachIndexed((i, a) {
int abs = DateTime.now().difference(a.date).inDays; int abs = DateTime.now().difference(a.date).inDays;
double startPos = (barTotal - abs) / barTotal; double startPos = (barTotal - abs) / barTotal;
@ -435,11 +437,14 @@ class AbsencesPageState extends State<AbsencesPage>
end: endPos, end: endPos,
color: a.state == Justification.excused color: a.state == Justification.excused
? Colors.green ? Colors.green
: Colors.red, : a.state == Justification.unexcused
? Colors.red
: Colors.orange,
)); ));
if ([...unexcused, ...excused].length > i + 1) { if ([...unexcused, ...excused, ...pending].length > i + 1) {
int nextAbs = DateTime.now() int nextAbs = DateTime.now()
.difference([...unexcused, ...excused][i + 1].date) .difference(
[...unexcused, ...excused, ...pending][i + 1].date)
.inDays; .inDays;
double nextStartPos = (barTotal - nextAbs) / barTotal; double nextStartPos = (barTotal - nextAbs) / barTotal;
@ -454,7 +459,8 @@ class AbsencesPageState extends State<AbsencesPage>
// print(value2.toString() + '-total'); // print(value2.toString() + '-total');
// print(absenceChartData.length.toString() + '-chartdata'); // print(absenceChartData.length.toString() + '-chartdata');
if ((i + 1 == [...unexcused, ...excused].length) && if ((i + 1 ==
[...unexcused, ...excused, ...pending].length) &&
endPos < 0.999) { endPos < 0.999) {
absenceChartData.add(AbsenceChartData( absenceChartData.add(AbsenceChartData(
start: endPos, start: endPos,

View File

@ -525,7 +525,7 @@ class LiveCardStateA extends State<LiveCard> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.secondary .tertiary
.withOpacity(.15), .withOpacity(.15),
borderRadius: borderRadius:
BorderRadius.circular(10.0), BorderRadius.circular(10.0),