From 397d1223c9526ea79636662f8908603e9c832f6b Mon Sep 17 00:00:00 2001 From: James Turk Date: Wed, 1 Apr 2015 17:20:58 -0400 Subject: [PATCH] drop old FitNotes data on new import --- lifting/importers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lifting/importers.py b/lifting/importers.py index c6787f5..1809016 100644 --- a/lifting/importers.py +++ b/lifting/importers.py @@ -23,6 +23,7 @@ def import_fitnotes_db(filename): # map to an Exercise id or str 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( '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] - 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')