Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Improves the duplicate_date_in_db call

Yuyu Aung25f1a90f1fcf
diff --git a/wger/weight/helpers.py b/wger/weight/helpers.py
index 10d1a5108..a13f478ed 100644
--- a/wger/weight/helpers.py
+++ b/wger/weight/helpers.py
@@ -53,7 +53,7 @@ def parse_weight_csv(request, cleaned_data):
parsed_date = datetime.datetime.strptime(row[0], cleaned_data['date_format'])
parsed_weight = decimal.Decimal(row[1].replace(',', '.'))
duplicate_date_in_db = WeightEntry.objects.filter(date=parsed_date,
- user=request.user)
+ user=request.user).exists()
# within the list there are no duplicates
unique_among_csv = (parsed_date, parsed_weight) not in distinct_weight_entries
# there is no existing weight entry in the database for that date