From 03e89a92c73ac1a40292d4e10108a61e95cf2df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Thu, 5 Jan 2023 22:00:51 +0100 Subject: [PATCH] Fix another duration formatting error --- Dockerfile | 2 +- src/web/common/util/time.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b916f9c..7b3e4d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN npm install && \ FROM python:3.10-slim-bullseye -ENV VERSION_NUMBER 0.1.0-36-ge6b5804 +ENV VERSION_NUMBER 0.1.0-37-g76bf03b ENV PROD 1 RUN useradd --create-home --uid 1000 timetracker diff --git a/src/web/common/util/time.py b/src/web/common/util/time.py index f707f86..5da1689 100644 --- a/src/web/common/util/time.py +++ b/src/web/common/util/time.py @@ -22,6 +22,8 @@ def format_duration( minute_seconds = 60 hour_seconds = 60 * minute_seconds day_seconds = 24 * hour_seconds + if not isinstance(duration, timedelta): + duration = timedelta(seconds=duration) seconds_total = int(duration.total_seconds()) # timestamps where end is before start if seconds_total < 0: