diff --git a/.gitignore b/.gitignore index 9f11b75..e6a15fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .idea/ +*.pyc +venv/ diff --git a/main.py b/main.py index b9fd26f..f20f432 100644 --- a/main.py +++ b/main.py @@ -44,11 +44,18 @@ 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]) + result = request.form + if "index" in result: + index = int(request.form["index"]) + people[index].status += 1 + if people[index].status == 3: + people.remove(people[index]) + if "name" in result: + index = people.index(Person(request.form["name"])) + print(index) + people[index].status += 1 + if people[index].status == 3: + people.remove(people[index]) return redirect("/") @@ -56,7 +63,7 @@ def statusUpdate(): def addPerson(): if request.method == "POST": result = request.form - if result["name"]: + if "name" in result: newPerson = Person(result["name"], result["remark"]) if newPerson not in people: people.append(newPerson) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..7e10602 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flask diff --git a/templates/home.html b/templates/home.html index 2eaddbc..2c73561 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,6 +1,12 @@ + Pannenkoekenwachtrij @@ -15,14 +21,28 @@
-

Up te daten persoon

-

+ +

Zie hieronder de lijst van personen die een pannenkoek willen

+

Volgende Persoon:

+ {% if people %} + + {{ people[0].getName() + people[0].getRemark() + ": " }} + {{ "Huidige status: " + people[0].getStatus() }} + + {% endif %} +

Andere Personen:

- {% for person in people %} + {% for person in people[1:] %} + @@ -30,4 +50,4 @@
+
+ + +
+
{{ person.getName() + person.getRemark() + ": " }} {{ "Huidige status: " + person.getStatus() }}
- \ No newline at end of file +