mirror of
https://github.com/iritmaximus/timetrials.git
synced 2026-10-12 19:13:48 +03:00
fix: game_id count
This commit is contained in:
@@ -8,6 +8,8 @@ table, tr, td {
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>There is {{count}} times in {{game_name}}</p>
|
||||
|
||||
<h2>Times</h2>
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -37,4 +37,6 @@ def get_all_times_in_game(id: int):
|
||||
WHERE times.game_id=:id
|
||||
"""
|
||||
results = db.session.execute(sql, {"id": id}).fetchall()
|
||||
return results
|
||||
sql = "SELECT count(times.id) FROM times WHERE times.game_id=:id"
|
||||
count = db.session.execute(sql, {"id": id}).fetchone()
|
||||
return results, count[0]
|
||||
|
||||
@@ -25,9 +25,9 @@ def get_game_by_id(game_id):
|
||||
return render_template(
|
||||
"error.html", message="Incorrect id, id not found or incorrect value"
|
||||
)
|
||||
times = get_all_times_in_game(game_id)
|
||||
times, count = get_all_times_in_game(game_id)
|
||||
return render_template(
|
||||
"game_id.html", times_exist=True, game_name=game_name, times=times
|
||||
"game_id.html", times_exist=True, game_name=game_name, times=times, count=count
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user