adding gold medal durations
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user