mirror of
https://github.com/iritmaximus/timetrials.git
synced 2026-10-12 19:13:48 +03:00
fix: added cups
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
from flaskr.database import db
|
||||
|
||||
|
||||
def query_cups():
|
||||
sql = "SELECT name FROM cups"
|
||||
result = db.session.execute(sql).fetchall()
|
||||
return result
|
||||
@@ -1 +1,24 @@
|
||||
<h1>Cups</h1>
|
||||
|
||||
<style>
|
||||
table, tr, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<table>
|
||||
{% if cups_exist %}
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
</tr>
|
||||
{% for item in cups %}
|
||||
<tr>
|
||||
<td>{{item[0]}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
<a href="/">Go back</a>
|
||||
|
||||
+5
-1
@@ -10,6 +10,7 @@ from flaskr.user import (
|
||||
)
|
||||
from flaskr.times import query_times, add_time
|
||||
from flaskr.games import query_games
|
||||
from flaskr.cups import query_cups
|
||||
|
||||
|
||||
@app.route("/")
|
||||
@@ -29,7 +30,10 @@ def get_games():
|
||||
|
||||
@app.route("/cups")
|
||||
def get_cups():
|
||||
return render_template("cups.html")
|
||||
cups = query_cups()
|
||||
if cups is None:
|
||||
return render_template("cups.html", cups_exist=False)
|
||||
return render_template("cups.html", cups=cups, cups_exist=True)
|
||||
|
||||
|
||||
@app.route("/courses")
|
||||
|
||||
Reference in New Issue
Block a user