Implemented error handling for "over-tracking"

This commit is contained in:
マリウス 2020-10-17 21:14:22 +01:00
parent 6732d9634a
commit 4f301a4ce4
No known key found for this signature in database
GPG key ID: C228EF0A530AF06F

View file

@ -145,6 +145,11 @@ func (calendar *Calendar) GetOutputForWeekCalendar(date time.Time, month int, we
totalHours = totalHours.Add(stat.Hours) totalHours = totalHours.Add(stat.Hours)
} }
if dayHours.GreaterThan(decimal.NewFromInt(24)) {
fmt.Printf("%s %s of week %d in month %d has more than 24h tracked; cutting at 24h now\n", CharError, day, (month+1), (week+1))
dayHours = decimal.NewFromInt(24)
}
bar := GetOutputBarForHours(dayHours, calendar.Months[month].Weeks[week].Statistics[day]) bar := GetOutputBarForHours(dayHours, calendar.Months[month].Weeks[week].Statistics[day])
bars = append(bars, bar) bars = append(bars, bar)
} }