don't explode when hacker doesn't specify schoolD
This commit is contained in:
parent
934467124f
commit
652160f352
1 changed files with 8 additions and 5 deletions
13
flask_app.py
13
flask_app.py
|
@ -273,11 +273,14 @@ def admin():
|
||||||
female_count += 1
|
female_count += 1
|
||||||
|
|
||||||
total_count += 1
|
total_count += 1
|
||||||
|
if not 'school' in hacker:
|
||||||
if hacker['school']['name'] not in schools:
|
print("Hacker has no school:")
|
||||||
schools[hacker['school']['name']] = 1
|
print(hacker)
|
||||||
else:
|
else:
|
||||||
schools[hacker['school']['name']] += 1
|
if hacker['school']['name'] not in schools:
|
||||||
|
schools[hacker['school']['name']] = 1
|
||||||
|
else:
|
||||||
|
schools[hacker['school']['name']] += 1
|
||||||
|
|
||||||
if hacker['major'] not in majors:
|
if hacker['major'] not in majors:
|
||||||
majors[hacker['major']] = 1
|
majors[hacker['major']] = 1
|
||||||
|
@ -299,7 +302,7 @@ def admin():
|
||||||
'phone_number': hacker['phone_number'],
|
'phone_number': hacker['phone_number'],
|
||||||
'shirt_size': (obj.shirt_size or '').upper(),
|
'shirt_size': (obj.shirt_size or '').upper(),
|
||||||
'special_needs': obj.special_needs,
|
'special_needs': obj.special_needs,
|
||||||
'school': hacker['school']
|
'school': hacker['school'] if 'school' in hacker else 'NULL'
|
||||||
})
|
})
|
||||||
|
|
||||||
return render_template('admin.html', hackers=hackers, total_count=total_count, waitlist_count=waitlist_count,
|
return render_template('admin.html', hackers=hackers, total_count=total_count, waitlist_count=waitlist_count,
|
||||||
|
|
Loading…
Add table
Reference in a new issue