From a133f2c86556e5f69974c38ec28349447b33facc Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sat, 3 Nov 2018 21:00:39 -0700 Subject: [PATCH] Add by-turn word count --- src/build.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/build.py b/src/build.py index 5f4520b..ca41c0b 100644 --- a/src/build.py +++ b/src/build.py @@ -188,9 +188,20 @@ def build_statistics_page(page, articles): content += "\n" # Total word count + all_articles = [] + for article in articles: + all_articles.append(article) + all_articles.extend(article.addendums) + turn_numbers = set([a.turn for a in articles if a.player is not None]) + aggregate = {num: 0 for num in turn_numbers} + for turn_num in turn_numbers: + for article in all_articles: + if article.turn <= turn_num: + aggregate[turn_num] += article_length[article.title] + aggr_list = [(str(k), [str(v)]) for k,v in aggregate.items()] content += "
\n" - content += "Total word count:
\n" - content += str(sum(article_length.values())) + content += "Aggregate word count by turn:
\n" + content += "
\n".join(itemize(aggr_list)) content += "
\n" # Player pageranks