Opening hours tests and bug fix

This commit is contained in:
Sam Splunks
2024-03-27 15:56:55 +00:00
parent 3be5bbed44
commit 1d8fc2ad42
2 changed files with 74 additions and 2 deletions

View File

@ -219,8 +219,8 @@ def daily_time_spent_calculation(earliest, latest, open_hours):
earliest_f = earliest.hour + earliest.minute / 60 + earliest.second / 3600
latest_f = latest.hour + latest.minute / 60 + latest.second / (60 * 60) + latest.microsecond / (60 * 60 * 999999)
# if latest time is midnight, add a second to the time spent
if latest_f >= 24:
# if latest time is midnight and close hour is midnight, add a second to the time spent
if latest_f >= 24 and end == MIDNIGHT:
time_spent_seconds += 1
if earliest_f < start: