Fix phantom exclusion in bottom pageranks

This commit is contained in:
Tim Van Baak 2018-11-05 09:36:59 -08:00
parent c125bdbe69
commit 6f51bde2cc
1 changed files with 3 additions and 7 deletions

View File

@ -259,13 +259,9 @@ def build_statistics_page(page, articles):
content += "</div>\n" content += "</div>\n"
# Lowest pagerank of written articles # Lowest pagerank of written articles
G = networkx.Graph() exclude = [a.title for a in articles if a.player is None]
for article in articles: rank_by_written_only = {k:v for k,v in rank_by_article.items() if k in exclude}
for citation in article.citations: pageranks = reverse_statistics_dict(rank_by_written_only)
if citation.article.player is not None:
G.add_edge(article.title, citation.target)
rank_by_article = networkx.pagerank(G)
pageranks = reverse_statistics_dict(rank_by_article)
bot_ranked = list(enumerate(map(lambda x: x[1], pageranks), start=1))[-10:] bot_ranked = list(enumerate(map(lambda x: x[1], pageranks), start=1))[-10:]
# Format the ranks into strings # Format the ranks into strings
bot_ranked_items = itemize(bot_ranked) bot_ranked_items = itemize(bot_ranked)