Add condition on tummytime-duration.py in order to display hours when necessary

This commit is contained in:
Anørak 2022-10-31 09:21:46 +01:00 committed by Christopher Charbonneau Wells
parent 6f83611f42
commit 9e1c21e7bd
1 changed files with 4 additions and 1 deletions

View File

@ -70,4 +70,7 @@ def _duration_string_ms(duration):
:returns: a string of the form Xm. :returns: a string of the form Xm.
""" """
h, m, s = duration_parts(duration) h, m, s = duration_parts(duration)
return "{}m{}s".format(m, s) if h > 0:
return "{}h{}m{}s".format(h, m, s)
else:
return "{}m{}s".format(m, s)