fixed error screen bug in summary maybe

This commit is contained in:
kima 2023-06-26 21:15:25 +02:00
parent 9d9f99a955
commit d2c762d29a

View File

@ -118,10 +118,13 @@ class _AllSumBodyState extends State<AllSumBody> {
void getDelays() { void getDelays() {
var allDelays = absenceProvider.absences.where((a) => a.delay > 0); var allDelays = absenceProvider.absences.where((a) => a.delay > 0);
var totalDelayTime = (allDelays.map((a) { var delayTimeList = (allDelays.map((a) {
return a.delay; return a.delay;
}).toList()) }).toList());
.reduce((a, b) => a + b); var totalDelayTime = 0;
if (delayTimeList.isNotEmpty) {
totalDelayTime = delayTimeList.reduce((a, b) => a + b);
}
var unexcusedDelays = absenceProvider.absences var unexcusedDelays = absenceProvider.absences
.where((a) => a.state == Justification.unexcused && a.delay > 0); .where((a) => a.state == Justification.unexcused && a.delay > 0);