drop old FitNotes data on new import
This commit is contained in:
parent
9d2bf76d3d
commit
397d1223c9
@ -23,6 +23,7 @@ def import_fitnotes_db(filename):
|
|||||||
# map to an Exercise id or str
|
# map to an Exercise id or str
|
||||||
exercise_id_mapping[fnid] = exercises[cleaned] if cleaned in exercises else cleaned
|
exercise_id_mapping[fnid] = exercises[cleaned] if cleaned in exercises else cleaned
|
||||||
|
|
||||||
|
Set.objects.filter(source='fitnotes').delete()
|
||||||
for fnid, date, weight_kg, reps in cur.execute(
|
for fnid, date, weight_kg, reps in cur.execute(
|
||||||
'SELECT exercise_id, date, metric_weight, reps FROM training_log'):
|
'SELECT exercise_id, date, metric_weight, reps FROM training_log'):
|
||||||
|
|
||||||
@ -33,4 +34,5 @@ def import_fitnotes_db(filename):
|
|||||||
|
|
||||||
exercise_id = exercise_id_mapping[fnid]
|
exercise_id = exercise_id_mapping[fnid]
|
||||||
|
|
||||||
Set.objects.create(exercise_id=exercise_id, date=date, weight_kg=weight_kg, reps=reps)
|
Set.objects.create(exercise_id=exercise_id, date=date, weight_kg=weight_kg, reps=reps,
|
||||||
|
source='fitnotes')
|
||||||
|
Loading…
Reference in New Issue
Block a user