made it possible to skip a certain person

This commit is contained in:
Jan-Pieter Baert 2019-01-30 18:37:09 +01:00
parent 0209010ab2
commit 2e40788bdb
No known key found for this signature in database
GPG key ID: B19186932178234A
2 changed files with 13 additions and 11 deletions

14
main.py
View file

@ -18,7 +18,7 @@ class Person:
return self.name
def __eq__(self, other):
return self.name == other.name
return self.name.lower() == other.name.lower()
def getStatus(self):
return self.statusses[self.status]
@ -41,12 +41,14 @@ def home():
return render_template("home.html", people=people)
@app.route("/statusUpdate")
@app.route("/statusUpdate", methods=["POST", "GET"])
def statusUpdate():
if people:
people[0].status += 1
if people[0].status == 3:
people.remove(people[0])
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])
return redirect("/")

View file

@ -14,16 +14,16 @@
<p><input type="submit" value="Persoon toevoegen"></p>
</form>
<form action="/statusUpdate" method="POST">
<p>Up te daten persoon <input type="text" name="name"></p>
<p><input type="submit" value="Updaten"></p>
</form>
<h2>Zie hieronder de lijst van personen die een pannenkoek willen</h2>
<table>
{% for person in people %}
<tr>
<th>{{ person.getName() + person.getRemark() + ": " }}</th>
<td>
<a href="/statusUpdate">
<input type="button" value="{{ person.nextStatus() }}"/>
</a>
</td>
<td>{{ "Huidige status: " + person.getStatus() }}</td>
</tr>
{% endfor %}