mirror of
https://github.com/iritmaximus/timetrials.git
synced 2026-10-12 19:13:48 +03:00
fix: fixed game_id path to show all times from the game
This commit is contained in:
@@ -11,18 +11,18 @@ table, tr, td {
|
||||
<h2>Times</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Time</td>
|
||||
<td>Course</td>
|
||||
<td>Cup</td>
|
||||
<td>Time</td>
|
||||
<td>User</td>
|
||||
</tr>
|
||||
{% if times_exist %}
|
||||
{% for time in times %}
|
||||
<tr>
|
||||
<td>time[0]</td>
|
||||
<td>time[1]</td>
|
||||
<td>time[2]</td>
|
||||
<td>time[3]</td>
|
||||
<td>{{time[0]}}</td>
|
||||
<td>{{time[1]}}</td>
|
||||
<td>{{time[2]}}</td>
|
||||
<td>{{time[3]}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
@@ -26,6 +26,13 @@ def get_game_name(id: int):
|
||||
|
||||
|
||||
def get_all_times_in_game(id: int):
|
||||
sql = "SELECT courses.name, times.course_id, users.username FROM times JOIN courses ON courses.id=times.course_id JOIN users ON users.id=times.user_id WHERE times.course_id=:id"
|
||||
sql = """
|
||||
SELECT courses.name, cups.name, times.timems, users.username
|
||||
FROM times
|
||||
JOIN courses ON courses.id=times.course_id
|
||||
JOIN cups ON cups.id=times.cup_id
|
||||
JOIN users ON users.id=times.user_id
|
||||
WHERE times.game_id=:id
|
||||
"""
|
||||
results = db.session.execute(sql, {"id": id}).fetchall()
|
||||
return results
|
||||
|
||||
@@ -26,7 +26,9 @@ def get_game_by_id(game_id):
|
||||
"error.html", message="Incorrect id, id not found or incorrect value"
|
||||
)
|
||||
times = get_all_times_in_game(game_id)
|
||||
return render_template("game_id.html", game_name=game_name, times=times)
|
||||
return render_template(
|
||||
"game_id.html", times_exist=True, game_name=game_name, times=times
|
||||
)
|
||||
|
||||
|
||||
@app.route("/api/game/<string:game_name>")
|
||||
|
||||
Reference in New Issue
Block a user