Edge case: manual duration of 1 day counts as "session in progress" #58

Closed
opened 2023-10-04 16:05:40 +00:00 by lukas · 0 comments
Owner

To determine whether a session is considered unfinished (in progress), we check if its timestamp_end is null and if seconds of duration_manual is 01. However, the DurationField in Django doesn't report total number of seconds, it only reports a remainder that doesn't fit neatly into one of the higher units. Thus when there is an exact amount of 24 hours, it equals 1 day and seconds are set to 0.


  1. if session.timestamp_end == None and session.duration_manual.seconds == 0:
    ↩︎

To determine whether a session is considered unfinished (in progress), we check if its `timestamp_end` is null and if seconds of `duration_manual` is 0[^1]. However, the `DurationField` in Django doesn't report total number of seconds, it only reports a remainder that doesn't fit neatly into one of the higher units. Thus when there is an exact amount of 24 hours, it equals 1 day and seconds are set to 0. [^1]: https://git.kucharczyk.xyz/lukas/timetracker/src/commit/d2a9630b048ef3a3a1721d7c1db2abb2902e1aff/games/views.py#L195
lukas closed this issue 2023-10-04 16:12:41 +00:00
lukas added spent time 20 minutes 2023-10-04 16:14:49 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Total Time Spent: 20 minutes
lukas
20 minutes
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lukas/timetracker#58
No description provided.