mirror of
https://github.com/iritmaximus/timetrials.git
synced 2026-10-12 19:13:48 +03:00
feat: added games list
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
from flaskr.database import db
|
||||||
|
|
||||||
|
|
||||||
|
def query_games():
|
||||||
|
sql = "SELECT name FROM games"
|
||||||
|
result = db.session.execute(sql).fetchall()
|
||||||
|
print(result)
|
||||||
|
return result
|
||||||
@@ -1 +1,24 @@
|
|||||||
<h1>Games</h1>
|
<h1>Games</h1>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
table, tr, td {
|
||||||
|
border: 1px solid black;
|
||||||
|
border-collapse: collapse;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
{% if games_exist %}
|
||||||
|
<tr>
|
||||||
|
<td>Name</td>
|
||||||
|
</tr>
|
||||||
|
{% for item in games %}
|
||||||
|
<tr>
|
||||||
|
<td>{{item[0]}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<a href="/">Go back</a>
|
||||||
|
|||||||
+5
-1
@@ -9,6 +9,7 @@ from flaskr.user import (
|
|||||||
create_new_user,
|
create_new_user,
|
||||||
)
|
)
|
||||||
from flaskr.times import query_times, add_time
|
from flaskr.times import query_times, add_time
|
||||||
|
from flaskr.games import query_games
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
@@ -21,7 +22,10 @@ def navigate():
|
|||||||
# TODO show 3 games with most times submitted
|
# TODO show 3 games with most times submitted
|
||||||
@app.route("/games")
|
@app.route("/games")
|
||||||
def get_games():
|
def get_games():
|
||||||
return render_template("games.html")
|
games = query_games()
|
||||||
|
if games is None:
|
||||||
|
return render_template("games.html", games_exist=False)
|
||||||
|
return render_template("games.html", games=games, games_exist=True)
|
||||||
|
|
||||||
|
|
||||||
# TODO show 3 courses with most activity
|
# TODO show 3 courses with most activity
|
||||||
|
|||||||
Reference in New Issue
Block a user