Fix display of duration_calculated, display durations less than a minute
This commit is contained in:
parent
6fe960bc04
commit
12cc9025a0
|
@ -1,4 +1,5 @@
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
* Fix display of duration_calculated, display durations less than a minute
|
||||||
* Make the "Finish now?" button on session list work
|
* Make the "Finish now?" button on session list work
|
||||||
* Hide navigation bar items if there are no games/purchases/sessions
|
* Hide navigation bar items if there are no games/purchases/sessions
|
||||||
* Set default version to "git-main" to indicate development environment
|
* Set default version to "git-main" to indicate development environment
|
||||||
|
|
|
@ -12,5 +12,5 @@ COPY entrypoint.sh /
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
USER timetracker
|
USER timetracker
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
ENV VERSION_NUMBER 0.1.0-14-g61d2e65
|
ENV VERSION_NUMBER 0.1.0-15-g6fe960b
|
||||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
ENTRYPOINT [ "/entrypoint.sh" ]
|
|
@ -60,10 +60,13 @@ class Session(models.Model):
|
||||||
if seconds == 0:
|
if seconds == 0:
|
||||||
return seconds
|
return seconds
|
||||||
hours, remainder = divmod(seconds, 3600)
|
hours, remainder = divmod(seconds, 3600)
|
||||||
minutes = remainder % 60
|
minutes = remainder // 60
|
||||||
hour_string = f"{int(hours)}h" if hours != 0 else ""
|
if hours == 0 and minutes == 0:
|
||||||
minute_string = f"{int(minutes)}m" if minutes != 0 else ""
|
return "less than a minute"
|
||||||
return f"{hour_string}{minute_string}"
|
else:
|
||||||
|
hour_string = f"{int(hours)}h" if hours != 0 else ""
|
||||||
|
minute_string = f"{int(minutes)}m" if minutes != 0 else ""
|
||||||
|
return f"{hour_string}{minute_string}"
|
||||||
|
|
||||||
def duration_any(self):
|
def duration_any(self):
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue