diff options
| author | 2020-12-01 18:33:11 +0100 | |
|---|---|---|
| committer | 2020-12-01 18:33:11 +0100 | |
| commit | ddb3dcf00573dd46e260ac2e39bfc09e68e68e44 (patch) | |
| tree | beecf25e92b35d5156190908393626b9756ef6f0 /bot/exts | |
| parent | Add support for ignoring scores from specific days (diff) | |
Fix daily stats by converting day, star to str
The daily stats function contained a bug that prevented it from working
correctly. The reason was that I was looking for `int` keys where the
actual keys were strings. I now make sure to create a `str` from the
`int` I get back from `range`.
Diffstat (limited to 'bot/exts')
| -rw-r--r-- | bot/exts/christmas/advent_of_code/_helpers.py | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/bot/exts/christmas/advent_of_code/_helpers.py b/bot/exts/christmas/advent_of_code/_helpers.py index e84348cb..f4a20955 100644 --- a/bot/exts/christmas/advent_of_code/_helpers.py +++ b/bot/exts/christmas/advent_of_code/_helpers.py @@ -123,8 +123,9 @@ def _parse_raw_leaderboard_data(raw_leaderboard_data: dict) -> dict:      # Create summary stats for the stars completed for each day of the event.      daily_stats = {}      for day in range(1, 26): -        star_one = len(star_results.get((day, 1), [])) -        star_two = len(star_results.get((day, 1), [])) +        day = str(day) +        star_one = len(star_results.get((day, "1"), [])) +        star_two = len(star_results.get((day, "2"), []))          # By using a dictionary instead of namedtuple here, we can serialize          # this data to JSON in order to cache it in Redis.          daily_stats[day] = {"star_one": star_one, "star_two": star_two} | 
