ignore duplicates for rolling wps
This commit is contained in:
@@ -1453,9 +1453,10 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
_ = update_wps(r, mytypes.otetypes)
|
||||
|
||||
# set user running wps
|
||||
if workouttype in otetypes:
|
||||
if not duplicate and workouttype in otetypes:
|
||||
cntr = Workout.objects.filter(user=r, workouttype__in=otetypes,
|
||||
startdatetime__gt=tz.now()-tz.timedelta(days=42)).count()
|
||||
startdatetime__gt=tz.now()-tz.timedelta(days=42),
|
||||
duplicate=False).count()
|
||||
new_value = (cntr*r.running_wps_erg + row.df['driveenergy'].mean())/(cntr+1.0)
|
||||
# if new_value is not zero or infinite or -inf, r.running_wps can be set to value
|
||||
if not (math.isnan(new_value) or math.isinf(new_value) or new_value == 0):
|
||||
@@ -1466,9 +1467,10 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
r.running_wps_erg = 600.
|
||||
r.save()
|
||||
|
||||
if workouttype in otwtypes:
|
||||
if not duplicate and workouttype in otwtypes:
|
||||
cntr = Workout.objects.filter(user=r, workouttype__in=otwtypes,
|
||||
startdatetime__gt=tz.now()-tz.timedelta(days=42)).count()
|
||||
startdatetime__gt=tz.now()-tz.timedelta(days=42),
|
||||
duplicate=False).count()
|
||||
new_value = (cntr*r.running_wps_erg + row.df['driveenergy'].mean())/(cntr+1.0)
|
||||
if not (math.isnan(new_value) or math.isinf(new_value) or new_value == 0):
|
||||
r.running_wps = new_value
|
||||
|
||||
Reference in New Issue
Block a user