review duplicates upon delete workout
This commit is contained in:
@@ -999,7 +999,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
maxhr = np.nan_to_num(maxhr)
|
||||
averagehr = np.nan_to_num(averagehr)
|
||||
|
||||
duplicate = True
|
||||
duplicate = False
|
||||
|
||||
t = datetime.datetime.strptime(duration,"%H:%M:%S.%f")
|
||||
delta = datetime.timedelta(hours=t.hour, minutes=t.minute, seconds=t.second)
|
||||
@@ -1007,7 +1007,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
workoutenddatetime = workoutstartdatetime+delta
|
||||
|
||||
# check for duplicate start times and duration
|
||||
ws = Workout.objects.filter(user=r,date=workoutdate).exclude(
|
||||
ws = Workout.objects.filter(user=r,date=workoutdate,duplicate=False).exclude(
|
||||
startdatetime__gt=workoutenddatetime
|
||||
)
|
||||
|
||||
@@ -1019,7 +1019,8 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
enddatetime = ww.startdatetime+delta
|
||||
if enddatetime > workoutstartdatetime:
|
||||
ws2.append(ww)
|
||||
|
||||
|
||||
|
||||
if (len(ws2) != 0):
|
||||
message = "Warning: This workout overlaps with an existing one and was marked as a duplicate"
|
||||
duplicate = True
|
||||
|
||||
Reference in New Issue
Block a user