This commit is contained in:
Maximilian Keßler 2023-12-30 21:44:05 +01:00
parent 6408d24de9
commit 5a7db5a873
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -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