From d06f56fc0d9eb7a3e635b6990b4bff75fa8e1781 Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Thu, 16 Feb 2017 12:32:03 +0000 Subject: [PATCH] Adjust unknown bin in the affiliation statistics too, adjust wording - Legacy-Id: 12859 --- ietf/stats/views.py | 29 ++++++++++--------- .../document_stats_author_affiliation.html | 10 ++++--- .../document_stats_author_continent.html | 2 +- .../stats/document_stats_author_country.html | 2 +- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ietf/stats/views.py b/ietf/stats/views.py index 3466e329a..b55362162 100644 --- a/ietf/stats/views.py +++ b/ietf/stats/views.py @@ -353,6 +353,17 @@ def document_stats(request, stats_type=None): total_persons = person_qs.distinct().count() + def prune_unknown_bin_with_known(bins): + # remove from the unknown bin all authors within the + # named/known bins + all_known = set(n for b, names in bins.iteritems() if b for n in names) + unknown = [] + for name in bins[""]: + if name not in all_known: + unknown.append(name) + bins[""] = unknown + + if stats_type == "author/documents": stats_title = "Number of {}s per author".format(doc_label) @@ -389,6 +400,8 @@ def document_stats(request, stats_type=None): for name, affiliation in name_affiliation_set: bins[aliases.get(affiliation, affiliation)].append(name) + prune_unknown_bin_with_known(bins) + series_data = [] for affiliation, names in sorted(bins.iteritems(), key=lambda t: t[0].lower()): percentage = len(names) * 100.0 / total_persons @@ -433,13 +446,7 @@ def document_stats(request, stats_type=None): if c and c.in_eu: bins[eu_name].append(name) - # remove from the unknown bin all authors with a known country - all_known = set(n for b, names in bins.iteritems() if b for n in names) - unknown = [] - for name in bins[""]: - if name not in all_known: - unknown.append(name) - bins[""] = unknown + prune_unknown_bin_with_known(bins) series_data = [] for country, names in sorted(bins.iteritems(), key=lambda t: t[0].lower()): @@ -478,13 +485,7 @@ def document_stats(request, stats_type=None): continent_name = country_to_continent.get(country_name, "") bins[continent_name].append(name) - # remove from the unknown bin all authors with a known continent - all_known = set(n for b, names in bins.iteritems() if b for n in names) - unknown = [] - for name in bins[""]: - if name not in all_known: - unknown.append(name) - bins[""] = unknown + prune_unknown_bin_with_known(bins) series_data = [] for continent, names in sorted(bins.iteritems(), key=lambda t: t[0].lower()): diff --git a/ietf/templates/stats/document_stats_author_affiliation.html b/ietf/templates/stats/document_stats_author_affiliation.html index e5bcb23c7..6bec8d3c8 100644 --- a/ietf/templates/stats/document_stats_author_affiliation.html +++ b/ietf/templates/stats/document_stats_author_affiliation.html @@ -58,15 +58,17 @@ -

Some authors are authors of multiple documents with different - affiliation information associated, so the sum of multiple rows in the - table can be more than 100%.

+

The statistics are based entirely on the author affiliation + provided with each draft. Since this may vary across documents, an + author may be counted with more than one affiliation, making the + total sum more than 100%.

Affiliation Aliases

-

In generating the above statistics, some heuristics have been applied to determine the affiliation of each author.

+

In generating the above statistics, some heuristics have been + applied to determine the affiliations of each author.

{% if request.GET.showaliases %}

Hide generated aliases

diff --git a/ietf/templates/stats/document_stats_author_continent.html b/ietf/templates/stats/document_stats_author_continent.html index b17d49552..0e0a1f849 100644 --- a/ietf/templates/stats/document_stats_author_continent.html +++ b/ietf/templates/stats/document_stats_author_continent.html @@ -59,6 +59,6 @@

The statistics are based entirely on the author addresses provided - in each draft. Since this varies across documents, a travelling + with each draft. Since this varies across documents, a travelling author may be counted in more than country, making the total sum more than 100%.

diff --git a/ietf/templates/stats/document_stats_author_country.html b/ietf/templates/stats/document_stats_author_country.html index 99c6d0152..93914abcb 100644 --- a/ietf/templates/stats/document_stats_author_country.html +++ b/ietf/templates/stats/document_stats_author_country.html @@ -59,7 +59,7 @@

The statistics are based entirely on the author addresses provided - in each draft. Since this varies across documents, a travelling + with each draft. Since this varies across documents, a travelling author may be counted in more than country, making the total sum more than 100%.