Fix display of duration_manual

This commit is contained in:
Lukáš Kucharczyk 2023-01-04 19:32:18 +01:00
parent 12cc9025a0
commit a1309c3738
3 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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" ]

View File

@ -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):