From 5a7db5a873fba600b2b9850730572f5eb812c9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 30 Dec 2023 21:44:05 +0100 Subject: [PATCH] stash --- src/render_site.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/render_site.py b/src/render_site.py index 7da7d21..cb74b3e 100644 --- a/src/render_site.py +++ b/src/render_site.py @@ -529,12 +529,6 @@ def get_player_list() -> List[Dict]: return res -@dataclass -class VariantELORow: - value_after: float - datetime_finished: datetime.datetime - - def get_variant_rating_progression(): cur = conn_manager.get_new_cursor() cur.execute( @@ -543,7 +537,8 @@ def get_variant_rating_progression(): " variants.name," " variant_ratings.num_players," " variant_ratings.value_after," - " games.datetime_finished " + " games.datetime_finished," + " dense_rank() over (order by games.league_id desc) " "FROM variants " "INNER JOIN variant_ratings" " ON variants.id = variant_ratings.variant_id " @@ -551,7 +546,7 @@ def get_variant_rating_progression(): " ON variant_ratings.league_id = games.league_id" ) ret = {} - for (rating_type, name, num_players, value_after, datetime_finished) in cur.fetchall(): + for (rating_type, name, num_players, value_after, datetime_finished, rank) in cur.fetchall(): if rating_type not in ret.keys(): ret[rating_type] = {} if name not in ret[rating_type].keys(): @@ -560,7 +555,8 @@ def get_variant_rating_progression(): ret[rating_type][name][num_players] = [] ret[rating_type][name][num_players].append({ "value_after": value_after, - "datetime_finished": datetime_finished.astimezone(datetime.timezone.utc).isoformat() + "datetime_finished": datetime_finished.astimezone(datetime.timezone.utc).isoformat(), + "rank": rank }) return ret