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

View file

@ -14,16 +14,16 @@
<p><input type="submit" value="Persoon toevoegen"></p> <p><input type="submit" value="Persoon toevoegen"></p>
</form> </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> <h2>Zie hieronder de lijst van personen die een pannenkoek willen</h2>
<table> <table>
{% for person in people %} {% for person in people %}
<tr> <tr>
<th>{{ person.getName() + person.getRemark() + ": " }}</th> <th>{{ person.getName() + person.getRemark() + ": " }}</th>
<td>
<a href="/statusUpdate">
<input type="button" value="{{ person.nextStatus() }}"/>
</a>
</td>
<td>{{ "Huidige status: " + person.getStatus() }}</td> <td>{{ "Huidige status: " + person.getStatus() }}</td>
</tr> </tr>
{% endfor %} {% endfor %}