Neues Abenteuer
This commit is contained in:
parent
472832a506
commit
3fccf79830
1 changed files with 8 additions and 2 deletions
10
app/app.py
10
app/app.py
|
|
@ -25,19 +25,25 @@ def start():
|
|||
return redirect("/app/raum/1")
|
||||
|
||||
html = '<h1>Verlies</h1>'
|
||||
|
||||
db = get_db()
|
||||
anzahl = db.execute("SELECT COUNT(*) AS n FROM spielstand").fetchone()
|
||||
html = html + '<p>' + str(anzahl["n"]) + ' Abenteurer waren schon hier.</p>'
|
||||
|
||||
if "spieler" in session:
|
||||
db = get_db()
|
||||
s = db.execute(
|
||||
"SELECT raum_id FROM spielstand WHERE spieler=?",
|
||||
(session["spieler"],)
|
||||
).fetchone()
|
||||
db.close()
|
||||
if s:
|
||||
html = html + '<p>Willkommen zurück, ' + session["spieler"] + '!</p>' \
|
||||
+ '<a href="/app/raum/' + str(s["raum_id"]) + '">Weiterspielen</a><hr>'
|
||||
db.close()
|
||||
|
||||
return html + '<form method="post">Dein Name: ' \
|
||||
+ '<input name="name"> <button>Abenteuer starten</button></form>'
|
||||
|
||||
|
||||
@app.route("/raum/<int:id>", methods=["GET", "POST"])
|
||||
def raum(id):
|
||||
db = get_db()
|
||||
|
|
|
|||
Loading…
Reference in a new issue