diff --git a/css/leaderboards.css b/css/leaderboards.css index 0326603..2f70b9c 100644 --- a/css/leaderboards.css +++ b/css/leaderboards.css @@ -67,7 +67,12 @@ body { } .stat-description { display: inline-block; - width: 13em; + width: 20em; +} +.stat-list { + padding-left: 1em; + padding-right: 1em; + list-style: inside; } .history-bullets { display: flex; @@ -75,7 +80,7 @@ body { flex-wrap: wrap; width: 100%; align-items: flex-start; - justify-content: space-around; + justify-content: space-between; } .history-bullets ul { flex-direction: column; diff --git a/src/render_site.py b/src/render_site.py index 0e9b455..e71e370 100644 --- a/src/render_site.py +++ b/src/render_site.py @@ -92,6 +92,8 @@ class GameRow: num_bdrs: int num_crits_lost: int game_outcomes: List[str] + variant_rating_change: float + variant_rating_after: float def get_games(): @@ -99,18 +101,20 @@ def get_games(): cur.execute( "SELECT" " game_data.game_id AS game_id," - " num_players," + " game_data.num_players," " users," " user_ids," - " variant_id," + " game_data.variant_id," " variants.name AS variant_name," " seed," " score," " num_turns," - " league_id," + " game_data.league_id," " num_bottom_deck_risks AS num_bdrs," " num_crits_lost," - " coalesce(array_agg(outcome ORDER BY outcome) FILTER (WHERE outcome IS NOT NULL), '{}') AS game_outcomes" + " coalesce(array_agg(outcome ORDER BY outcome) FILTER (WHERE outcome IS NOT NULL), '{}') AS game_outcomes," + " change AS variant_rating_change," + " value_after AS variant_rating_after" " FROM" " (" " SELECT " @@ -139,17 +143,23 @@ def get_games(): " ) AS game_data " "LEFT OUTER JOIN game_outcomes " " ON game_outcomes.game_id = game_data.game_id " - " LEFT OUTER JOIN variants" - " ON variants.id = game_data.variant_id " + "LEFT OUTER JOIN variants" + " ON variants.id = game_data.variant_id " + "LEFT OUTER JOIN variant_ratings" + " ON variant_ratings.league_id = game_data.league_id " "GROUP BY (" - " game_data.game_id, num_players, users, user_ids, variant_id, variants.name, seed, score, num_turns," - " league_id, num_bottom_deck_risks, num_crits_lost" + " game_data.game_id, game_data.num_players, users, user_ids, game_data.variant_id, variants.name, seed, score, num_turns," + " game_data.league_id, num_bottom_deck_risks, num_crits_lost, change, value_after" " ) " "ORDER BY league_id DESC" ) res = [] for row in cur.fetchall(): row['game_outcomes'] = [stats.GameOutcome(outcome).string for outcome in row['game_outcomes']] + if row['variant_rating_change'] is not None: + row['variant_rating_change'] = round(row['variant_rating_change'], 2) + if row['variant_rating_after'] is not None: + row['variant_rating_after'] = round(row['variant_rating_after'], 2) res.append(GameRow(**row)) return res diff --git a/templates/stats_table.html b/templates/stats_table.html new file mode 100644 index 0000000..42ec306 --- /dev/null +++ b/templates/stats_table.html @@ -0,0 +1,47 @@ + +