Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Limited csv rows to 1000

purplebird7cb9b82bdc55
diff --git a/wger/weight/helpers.py b/wger/weight/helpers.py
index 670d9a736..e26787f21 100644
--- a/wger/weight/helpers.py
+++ b/wger/weight/helpers.py
@@ -47,6 +47,8 @@ def parse_weight_csv(request, cleaned_data):
entry_dates = set()
weight_list = []
error_list = []
+ MAX_ROW_COUNT = 1000
+ row_count = 0
# Process the CSV items first
for row in parsed_csv:
@@ -69,6 +71,9 @@ def parse_weight_csv(request, cleaned_data):
except (ValueError, IndexError, decimal.InvalidOperation):
error_list.append(row)
+ row_count += 1
+ if row_count > MAX_ROW_COUNT:
+ break
# Create the valid weight entries
for date, weight in distinct_weight_entries: