From 7ffc2ba1e1b18930e333a501b3d87912ebe04046 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sun, 8 Jul 2018 00:39:20 -0700 Subject: [PATCH] Fix bug with articles without a pagerank --- src/build.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/build.py b/src/build.py index e260597..bf35602 100644 --- a/src/build.py +++ b/src/build.py @@ -208,7 +208,9 @@ def build_statistics_page(articles, config): for a in articles if a.player == player] for player in players} - player_rank = {player : sum(map(lambda a: ranks[a.title], articles)) for player, articles in articles_by.items()} + player_rank = { + player : sum(map(lambda a: ranks[a.title] if a.title in ranks else 0, articles)) + for player, articles in articles_by.items()} content += "
\n".join(map( lambda kv: "{0} – {1}".format(kv[0], round(kv[1], 3)), sorted(player_rank.items(), key=lambda t:t[1], reverse=True)))