Fix session being wrongly considered in progress

Fixes #58
This commit is contained in:
Lukáš Kucharczyk 2023-10-04 18:12:13 +02:00
parent 3e04ef2b83
commit 470426004e
2 changed files with 4 additions and 1 deletions

View File

@ -12,6 +12,7 @@
* Change fonts to IBM Plex * Change fonts to IBM Plex
* Only use local WOFF2 font files * Only use local WOFF2 font files
* Add game overview page (https://git.kucharczyk.xyz/lukas/timetracker/issues/8) * Add game overview page (https://git.kucharczyk.xyz/lukas/timetracker/issues/8)
* Fix session being wrongly considered in progress if it had a certain amount of manual hours (https://git.kucharczyk.xyz/lukas/timetracker/issues/58)
## 1.0.3 / 2023-02-20 17:16+01:00 ## 1.0.3 / 2023-02-20 17:16+01:00

View File

@ -192,7 +192,9 @@ def list_sessions(
dataset = Session.objects.all().order_by("-timestamp_start") dataset = Session.objects.all().order_by("-timestamp_start")
for session in dataset: for session in dataset:
if session.timestamp_end == None and session.duration_manual.seconds == 0: if session.timestamp_end == None and session.duration_manual == timedelta(
seconds=0
):
session.timestamp_end = datetime.now(ZoneInfo(settings.TIME_ZONE)) session.timestamp_end = datetime.now(ZoneInfo(settings.TIME_ZONE))
session.unfinished = True session.unfinished = True