From dee6a5161fe8390068899d58baff9eb09569a57d Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 18 May 2025 12:05:02 +0200 Subject: [PATCH] fix(duration): integer modulo by zero --- shiftregister/app/templatetags/shift_extras.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shiftregister/app/templatetags/shift_extras.py b/shiftregister/app/templatetags/shift_extras.py index c6e2a42..1f34c79 100644 --- a/shiftregister/app/templatetags/shift_extras.py +++ b/shiftregister/app/templatetags/shift_extras.py @@ -7,6 +7,7 @@ register = template.Library() def duration(value): secs = int(value.total_seconds()) hours = secs // (60 * 60) - secs = secs % (hours * 60 * 60) + if hours > 0: + secs = secs % (hours * 60 * 60) minutes = secs // 60 return f"{hours}:{minutes:02d}h"