Änderung
This commit is contained in:
parent
beac0da3aa
commit
1f2ac85c31
1 changed files with 14 additions and 0 deletions
14
app/app.py
14
app/app.py
|
|
@ -11,6 +11,7 @@ def get_db():
|
|||
|
||||
@app.route("/", methods=["GET", "POST"])
|
||||
def start():
|
||||
|
||||
if request.method == "POST": # Formular abgeschickt?
|
||||
name = request.form["name"].strip()
|
||||
if name != "":
|
||||
|
|
@ -38,6 +39,19 @@ def start():
|
|||
return html + '<form method="post">Dein Name: ' \
|
||||
+ '<input name="name"> <button>Abenteuer starten</button></form>'
|
||||
|
||||
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>'
|
||||
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