fixed that when the person isn't in the queue the site doesn't crash

This commit is contained in:
Jan-Pieter Baert 2019-02-13 22:02:14 +01:00
parent f798a27a90
commit 6871bfd3bf
No known key found for this signature in database
GPG Key ID: B19186932178234A
1 changed files with 7 additions and 5 deletions

12
main.py
View File

@ -44,11 +44,13 @@ def home():
@app.route("/statusUpdate", methods=["POST", "GET"])
def statusUpdate():
if people and request.method == "POST":
index = people.index(Person(request.form["name"]))
print(index)
people[index].status += 1
if people[index].status == 3:
people.remove(people[index])
newPerson = Person(request.form["name"])
if newPerson in people:
index = people.index(newPerson)
print(index)
people[index].status += 1
if people[index].status == 3:
people.remove(people[index])
return redirect("/")