diff --git a/gmba_django/convert.py b/gmba_django/convert.py index 53a1d0c..d260eda 100644 --- a/gmba_django/convert.py +++ b/gmba_django/convert.py @@ -83,7 +83,8 @@ def refresh_data(filename, fmt=None): datareader = csv.DictReader(csvfile) for row in datareader: rowcount += 1 - if row is None: continue + if row is None: + continue yield rowcount, rowcount / totalrows # # Ensure any new data is flushed from time to time @@ -149,17 +150,20 @@ def refresh_data(filename, fmt=None): ppl, source_id = get_by_id(row['Person'], Person, first=False) if not ppl or not ppl.first(): continue for person in ppl: - for r in rzs: person.resources.append(r) + for r in rzs: + person.resources.append(r) person.save() count = count + 1 elif fmt['dataformat'] is DataFormat.PERSON_RANGE: rzs, source_id = get_by_id(row['MountainRange'], Range, first=False) - if not rzs or not rzs.first(): continue + if not rzs or not rzs.first(): + continue ppl, source_id = get_by_id(row['Person'], Person, first=False) if not ppl or not ppl.first(): continue for person in ppl: - for r in rzs: person.ranges.append(r) + for r in rzs: + person.ranges.append(r) person.save() count = count + 1