Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2018-11-27 08:50:19 +01:00
parent c1ee308b99
commit f17dbadf8a
2 changed files with 26 additions and 9 deletions

View File

@@ -744,16 +744,27 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
duplicate=False,
title='Manual entry',notes='',weightcategory='hwt'):
if duration is not None:
totalseconds = duration.hour*3600.
totalseconds += duration.minute*60.
totalseconds += duration.second
totalseconds += duration.microsecond/1.e6
else:
totalseconds = 60.
nr_strokes = int(distance/10.)
if distance is None:
distance = 0
try:
nr_strokes = int(distance/10.)
except TypeError:
nr_strokes = int(20.*totalseconds)
if nr_strokes == 0:
nr_strokes = 100
unixstarttime = arrow.get(startdatetime).timestamp
totalseconds = duration.hour*3600.
totalseconds += duration.minute*60.
totalseconds += duration.second
totalseconds += duration.microsecond/1.e6
if not avgspm:
try:
@@ -773,7 +784,10 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
unixtime = unixstarttime + elapsed
pace = 500.*totalseconds/distance
try:
pace = 500.*totalseconds/distance
except ZeroDivisionError:
pace = 240.
if workouttype in ['rower','slides','dynamic']:
try: