fix leaderboard by action_id

This commit is contained in:
norohind 2021-12-15 21:31:24 +03:00
parent b3449c7c63
commit d1ec8b2b69
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1
3 changed files with 11 additions and 4 deletions

View File

@ -178,7 +178,7 @@ class PostgresModel(AbstractModel):
with self.db.cursor(cursor_factory=psycopg2.extras.RealDictCursor) as cursor:
cursor.execute(
postgres_sql_requests.select_last_action_id,
postgres_sql_requests.select_leaderboard_by_action_id,
{
'action_id': action_id
}

View File

@ -97,7 +97,14 @@ limit 1000;
"""
select_leaderboard_by_action_id = """select
*
name,
tag,
rank,
score,
to_char(timestamp, 'YYYY-MM-DD HH24:MI:SS') as timestamp,
leaderboard_type,
platform,
squadron_id
from squads_stats_states
where action_id = %(action_id)s
order by score desc;

4
web.py
View File

@ -126,7 +126,7 @@ class SumLeaderboardHistoryHtml:
class LeaderboardByActionID:
def on_get(self, req: falcon.request.Request, resp: falcon.response.Response, action_id: int) -> None:
resp.content_type = falcon.MEDIA_JSON
resp.text = json.dumps(model.get_diff_action_id(action_id))
resp.text = json.dumps(model.get_leaderboard_by_action_id(action_id))
class LeaderboardByActionIDHTML:
@ -136,7 +136,7 @@ class LeaderboardByActionIDHTML:
'table_template.html',
{
'target_column_name': 'Tag',
'target_new_url': '/squads/now/by-tag/short/'
'target_new_url': '/api/leaderboard-state/by-action-id/'
}
)