WebHost: update modules (#1176)

Fix bokeh 3.0.0 attribute removal and touch up stats.py while at it
This commit is contained in:
Fabian Dill 2022-11-01 23:01:53 +01:00 committed by GitHub
parent ab9f3767e2
commit 85130f2bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -2,6 +2,6 @@ flask>=2.2.2
pony>=0.7.16
waitress>=2.1.2
Flask-Caching>=2.0.1
Flask-Compress>=1.12
Flask-Limiter>=2.6.2
bokeh>=2.4.3
Flask-Compress>=1.13
Flask-Limiter>=2.7.0
bokeh>=3.0.0

View File

@ -18,7 +18,8 @@ from .models import Room
PLOT_WIDTH = 600
def get_db_data(known_games: str) -> typing.Tuple[typing.Dict[str, int], typing.Dict[datetime.date, typing.Dict[str, int]]]:
def get_db_data(known_games: typing.Set[str]) -> typing.Tuple[typing.Counter[str],
typing.DefaultDict[datetime.date, typing.Dict[str, int]]]:
games_played = defaultdict(Counter)
total_games = Counter()
cutoff = date.today()-timedelta(days=30)
@ -93,7 +94,7 @@ def stats():
occurences, legend_label=game, line_width=2, color=game_to_color[game])
total = sum(total_games.values())
pie = figure(plot_height=350, title=f"Games Played in the Last 30 Days (Total: {total})", toolbar_location=None,
pie = figure(title=f"Games Played in the Last 30 Days (Total: {total})", toolbar_location=None,
tools="hover", tooltips=[("Game:", "@games"), ("Played:", "@count")],
sizing_mode="scale_both", width=PLOT_WIDTH, height=500, x_range=(-0.5, 1.2))
pie.axis.visible = False
@ -121,7 +122,8 @@ def stats():
start_angle="start_angles", end_angle="end_angles", fill_color="colors",
source=ColumnDataSource(data=data), legend_field="games")
per_game_charts = [create_game_played_figure(games_played, game, game_to_color[game]) for game in total_games
per_game_charts = [create_game_played_figure(games_played, game, game_to_color[game]) for game in
sorted(total_games, key=lambda game: total_games[game])
if total_games[game] > 1]
script, charts = components((plot, pie, *per_game_charts))