Skip to content

Commit d06f56f

Browse files
committed
Adjust unknown bin in the affiliation statistics too, adjust wording
- Legacy-Id: 12859
1 parent 1a0e459 commit d06f56f

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

ietf/stats/views.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,17 @@ def generate_canonical_names(docalias_qs):
353353

354354
total_persons = person_qs.distinct().count()
355355

356+
def prune_unknown_bin_with_known(bins):
357+
# remove from the unknown bin all authors within the
358+
# named/known bins
359+
all_known = set(n for b, names in bins.iteritems() if b for n in names)
360+
unknown = []
361+
for name in bins[""]:
362+
if name not in all_known:
363+
unknown.append(name)
364+
bins[""] = unknown
365+
366+
356367
if stats_type == "author/documents":
357368
stats_title = "Number of {}s per author".format(doc_label)
358369

@@ -389,6 +400,8 @@ def generate_canonical_names(docalias_qs):
389400
for name, affiliation in name_affiliation_set:
390401
bins[aliases.get(affiliation, affiliation)].append(name)
391402

403+
prune_unknown_bin_with_known(bins)
404+
392405
series_data = []
393406
for affiliation, names in sorted(bins.iteritems(), key=lambda t: t[0].lower()):
394407
percentage = len(names) * 100.0 / total_persons
@@ -433,13 +446,7 @@ def generate_canonical_names(docalias_qs):
433446
if c and c.in_eu:
434447
bins[eu_name].append(name)
435448

436-
# remove from the unknown bin all authors with a known country
437-
all_known = set(n for b, names in bins.iteritems() if b for n in names)
438-
unknown = []
439-
for name in bins[""]:
440-
if name not in all_known:
441-
unknown.append(name)
442-
bins[""] = unknown
449+
prune_unknown_bin_with_known(bins)
443450

444451
series_data = []
445452
for country, names in sorted(bins.iteritems(), key=lambda t: t[0].lower()):
@@ -478,13 +485,7 @@ def generate_canonical_names(docalias_qs):
478485
continent_name = country_to_continent.get(country_name, "")
479486
bins[continent_name].append(name)
480487

481-
# remove from the unknown bin all authors with a known continent
482-
all_known = set(n for b, names in bins.iteritems() if b for n in names)
483-
unknown = []
484-
for name in bins[""]:
485-
if name not in all_known:
486-
unknown.append(name)
487-
bins[""] = unknown
488+
prune_unknown_bin_with_known(bins)
488489

489490
series_data = []
490491
for continent, names in sorted(bins.iteritems(), key=lambda t: t[0].lower()):

ietf/templates/stats/document_stats_author_affiliation.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ <h3>Data</h3>
5858
</tbody>
5959
</table>
6060

61-
<p>Some authors are authors of multiple documents with different
62-
affiliation information associated, so the sum of multiple rows in the
63-
table can be more than 100%.</p>
61+
<p>The statistics are based entirely on the author affiliation
62+
provided with each draft. Since this may vary across documents, an
63+
author may be counted with more than one affiliation, making the
64+
total sum more than 100%.</p>
6465

6566

6667

6768
<h3>Affiliation Aliases</h3>
6869

69-
<p>In generating the above statistics, some heuristics have been applied to determine the affiliation of each author.</p>
70+
<p>In generating the above statistics, some heuristics have been
71+
applied to determine the affiliations of each author.</p>
7072

7173
{% if request.GET.showaliases %}
7274
<p><a href="{{ hide_aliases_url }}" class="btn btn-default">Hide generated aliases</a></p>

ietf/templates/stats/document_stats_author_continent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ <h3>Data</h3>
5959
</table>
6060

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

ietf/templates/stats/document_stats_author_country.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ <h3>Data</h3>
5959
</table>
6060

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

0 commit comments

Comments
 (0)