fixing plannedsessions_view
This commit is contained in:
@@ -126,8 +126,7 @@ def rscore_approx(row):
|
|||||||
else:
|
else:
|
||||||
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
|
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
|
||||||
dd = dd/3600
|
dd = dd/3600
|
||||||
print(row['rpe'],dd,rpetotss[row['rpe']])
|
return int(rpetotss[row['rpe']]*dd)
|
||||||
return rpetotss[row['rpe']]*dd
|
|
||||||
if row['rscore'] < 0:
|
if row['rscore'] < 0:
|
||||||
w = Workout.objects.get(id=row['id'])
|
w = Workout.objects.get(id=row['id'])
|
||||||
trimp, hrtss = workout_trimp(w)
|
trimp, hrtss = workout_trimp(w)
|
||||||
@@ -135,12 +134,11 @@ def rscore_approx(row):
|
|||||||
if row['rpe'] and row['rpe'] > 0:
|
if row['rpe'] and row['rpe'] > 0:
|
||||||
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
|
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
|
||||||
dd = dd/3600
|
dd = dd/3600
|
||||||
return rpetotss[row['rpe']]*dd
|
return int(rpetotss[row['rpe']]*dd)
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
minutes = row['duration'].hour*60+row['duration'].minute
|
minutes = row['duration'].hour*60+row['duration'].minute
|
||||||
return minutes
|
return minutes
|
||||||
|
|
||||||
print('boer')
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1518,12 +1518,15 @@ def plannedsessions_view(request,
|
|||||||
for w in ws:
|
for w in ws:
|
||||||
thetrimp, hrtss = dataprep.workout_trimp(w)
|
thetrimp, hrtss = dataprep.workout_trimp(w)
|
||||||
totals['trimp'] += thetrimp
|
totals['trimp'] += thetrimp
|
||||||
tss = dataprep.workout_rscore(w)[0]
|
row = {
|
||||||
if not np.isnan(tss) and tss != 0:
|
'rscore': w.rscore,
|
||||||
totals['rscore'] += tss
|
'hrtss': w.hrtss,
|
||||||
elif tss == 0:
|
'rpe': w.rpe,
|
||||||
totals['rscore'] += hrtss
|
'duration': w.duration,
|
||||||
tss = hrtss
|
'id': w.id
|
||||||
|
}
|
||||||
|
tss = dataprep.rscore_approx(row)
|
||||||
|
totals['rscore'] += tss
|
||||||
totals['distance'] += w.distance
|
totals['distance'] += w.distance
|
||||||
totals['time'] += timefield_to_seconds_duration(w.duration)
|
totals['time'] += timefield_to_seconds_duration(w.duration)
|
||||||
if w.plannedsession: # pragma: no cover
|
if w.plannedsession: # pragma: no cover
|
||||||
|
|||||||
Reference in New Issue
Block a user