fix: game_id count

This commit is contained in:
iritmaximus
2023-03-05 14:18:28 +02:00
parent 8ed709a5e7
commit 45c84cc0d9
3 changed files with 7 additions and 3 deletions
+2
View File
@@ -8,6 +8,8 @@ table, tr, td {
}
</style>
<p>There is {{count}} times in {{game_name}}</p>
<h2>Times</h2>
<table>
<tr>
+3 -1
View File
@@ -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]
+2 -2
View File
@@ -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
)