From a1309c3738a51ae4fdcbb89c863e23927e76fe19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 4 Jan 2023 19:32:18 +0100 Subject: [PATCH] Fix display of duration_manual --- CHANGELOG.md | 1 + Dockerfile | 2 +- src/web/tracker/models.py | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1605a0..da7befc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ## Unreleased +* Fix display of duration_manual * Fix display of duration_calculated, display durations less than a minute * Make the "Finish now?" button on session list work * Hide navigation bar items if there are no games/purchases/sessions diff --git a/Dockerfile b/Dockerfile index e3c0c84..ccf2f9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,5 +12,5 @@ COPY entrypoint.sh / RUN chmod +x /entrypoint.sh USER timetracker EXPOSE 8000 -ENV VERSION_NUMBER 0.1.0-15-g6fe960b +ENV VERSION_NUMBER 0.1.0-16-g12cc902 ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/src/web/tracker/models.py b/src/web/tracker/models.py index 3e1692c..397a951 100644 --- a/src/web/tracker/models.py +++ b/src/web/tracker/models.py @@ -46,13 +46,13 @@ class Session(models.Model): self.timestamp_end = datetime.now(ZoneInfo(settings.TIME_ZONE)) def duration_seconds(self): - if self.timestamp_end == None or self.timestamp_start == None: - if self.duration_manual == None: + if self.duration_manual == None: + if self.timestamp_end == None or self.timestamp_start == None: return 0 else: - value = self.duration_manual + value = self.timestamp_end - self.timestamp_start else: - value = self.timestamp_end - self.timestamp_start + value = self.duration_manual return value.total_seconds() def duration_formatted(self):