Fix more formatting issues

This commit is contained in:
PCoder 2021-07-27 10:30:20 +05:30
parent 8685c4a7a2
commit a76c547fc4

View file

@ -83,7 +83,8 @@ def refresh_data(filename, fmt=None):
datareader = csv.DictReader(csvfile) datareader = csv.DictReader(csvfile)
for row in datareader: for row in datareader:
rowcount += 1 rowcount += 1
if row is None: continue if row is None:
continue
yield rowcount, rowcount / totalrows yield rowcount, rowcount / totalrows
# # Ensure any new data is flushed from time to time # # 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) ppl, source_id = get_by_id(row['Person'], Person, first=False)
if not ppl or not ppl.first(): continue if not ppl or not ppl.first(): continue
for person in ppl: for person in ppl:
for r in rzs: person.resources.append(r) for r in rzs:
person.resources.append(r)
person.save() person.save()
count = count + 1 count = count + 1
elif fmt['dataformat'] is DataFormat.PERSON_RANGE: elif fmt['dataformat'] is DataFormat.PERSON_RANGE:
rzs, source_id = get_by_id(row['MountainRange'], Range, first=False) 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) ppl, source_id = get_by_id(row['Person'], Person, first=False)
if not ppl or not ppl.first(): continue if not ppl or not ppl.first(): continue
for person in ppl: for person in ppl:
for r in rzs: person.ranges.append(r) for r in rzs:
person.ranges.append(r)
person.save() person.save()
count = count + 1 count = count + 1