Private
Public Access
1
0

adding gold medal durations

This commit is contained in:
Sander Roosendaal
2020-12-07 08:54:50 +01:00
parent 0bb0237aee
commit 939a3e27c0
7 changed files with 70 additions and 33 deletions

View File

@@ -376,7 +376,7 @@ def wavg(group, avg_name, weight_name):
except ZeroDivisionError:
return d.mean()
def totaltime_sec_to_string(totaltime):
def totaltime_sec_to_string(totaltime,shorten=False):
hours = int(totaltime / 3600.)
if hours > 23:
message = 'Warning: The workout duration was longer than 23 hours. '
@@ -400,12 +400,29 @@ def totaltime_sec_to_string(totaltime):
if not message:
message = 'Warning: there is something wrong with the workout duration'
duration = "{hours:02d}:{minutes:02d}:{seconds:02d}.{tenths}".format(
hours=hours,
minutes=minutes,
seconds=seconds,
tenths=tenths
)
duration = ""
if not shorten:
duration = "{hours:02d}:{minutes:02d}:{seconds:02d}.{tenths}".format(
hours=hours,
minutes=minutes,
seconds=seconds,
tenths=tenths
)
else:
if hours != 0:
duration = "{hours}:{minutes:02d}:{seconds:02d}".format(
hours=hours,
minutes=minutes,
seconds=seconds,
tenths=tenths
)
else:
duration = "{minutes}:{seconds:02d}".format(
hours=hours,
minutes=minutes,
seconds=seconds,
tenths=tenths
)
return duration