Skip to content

Commit 85130f2

Browse files
authored
WebHost: update modules (#1176)
Fix bokeh 3.0.0 attribute removal and touch up stats.py while at it
1 parent ab9f376 commit 85130f2

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

WebHostLib/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ flask>=2.2.2
22
pony>=0.7.16
33
waitress>=2.1.2
44
Flask-Caching>=2.0.1
5-
Flask-Compress>=1.12
6-
Flask-Limiter>=2.6.2
7-
bokeh>=2.4.3
5+
Flask-Compress>=1.13
6+
Flask-Limiter>=2.7.0
7+
bokeh>=3.0.0

WebHostLib/stats.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
PLOT_WIDTH = 600
1919

2020

21-
def get_db_data(known_games: str) -> typing.Tuple[typing.Dict[str, int], typing.Dict[datetime.date, typing.Dict[str, int]]]:
21+
def get_db_data(known_games: typing.Set[str]) -> typing.Tuple[typing.Counter[str],
22+
typing.DefaultDict[datetime.date, typing.Dict[str, int]]]:
2223
games_played = defaultdict(Counter)
2324
total_games = Counter()
2425
cutoff = date.today()-timedelta(days=30)
@@ -93,7 +94,7 @@ def stats():
9394
occurences, legend_label=game, line_width=2, color=game_to_color[game])
9495

9596
total = sum(total_games.values())
96-
pie = figure(plot_height=350, title=f"Games Played in the Last 30 Days (Total: {total})", toolbar_location=None,
97+
pie = figure(title=f"Games Played in the Last 30 Days (Total: {total})", toolbar_location=None,
9798
tools="hover", tooltips=[("Game:", "@games"), ("Played:", "@count")],
9899
sizing_mode="scale_both", width=PLOT_WIDTH, height=500, x_range=(-0.5, 1.2))
99100
pie.axis.visible = False
@@ -121,7 +122,8 @@ def stats():
121122
start_angle="start_angles", end_angle="end_angles", fill_color="colors",
122123
source=ColumnDataSource(data=data), legend_field="games")
123124

124-
per_game_charts = [create_game_played_figure(games_played, game, game_to_color[game]) for game in total_games
125+
per_game_charts = [create_game_played_figure(games_played, game, game_to_color[game]) for game in
126+
sorted(total_games, key=lambda game: total_games[game])
125127
if total_games[game] > 1]
126128

127129
script, charts = components((plot, pie, *per_game_charts))

0 commit comments

Comments
 (0)