From d5e98c9644d58ab9504c2740891d22b60549c611 Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Fri, 17 Feb 2017 10:21:34 +0000 Subject: [PATCH] Add mail to link to Secretariat on country page in case people are missing a country or alias, adjust wording a bit on status page. - Legacy-Id: 12866 --- ietf/settings.py | 2 ++ ietf/stats/models.py | 2 +- ietf/stats/utils.py | 15 +++++++++++++++ ietf/stats/views.py | 3 ++- ietf/templates/stats/known_countries_list.html | 16 +++++++++++++++- ietf/templates/submit/submission_status.html | 2 +- 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ietf/settings.py b/ietf/settings.py index 6f815617f..ea3681dda 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -518,6 +518,8 @@ IPR_EMAIL_FROM = 'ietf-ipr@ietf.org' IANA_EVAL_EMAIL = "drafts-eval@icann.org" +SECRETARIAT_TICKET_EMAIL = "ietf-action@ietf.org" + # Put real password in settings_local.py IANA_SYNC_PASSWORD = "secret" IANA_SYNC_CHANGES_URL = "https://datatracker.iana.org:4443/data-tracker/changes" diff --git a/ietf/stats/models.py b/ietf/stats/models.py index 875a81afa..9aa919b46 100644 --- a/ietf/stats/models.py +++ b/ietf/stats/models.py @@ -30,7 +30,7 @@ class CountryAlias(models.Model): """Records that alias should be treated as country for statistical purposes.""" - alias = models.CharField(max_length=255, help_text="Note that lower-case aliases are matched case-insensitive while aliases with at least one uppercase letter is matched case-sensitive.") + alias = models.CharField(max_length=255, help_text="Note that lower-case aliases are matched case-insensitive while aliases with at least one uppercase letter is matched case-sensitive. So 'United States' is best entered as 'united states' so it both matches 'United States' and 'United states' and 'UNITED STATES', whereas 'US' is best entered as 'US' so it doesn't accidentally match an ordinary word like 'us'.") country = models.ForeignKey(CountryName, max_length=255) def __unicode__(self): diff --git a/ietf/stats/utils.py b/ietf/stats/utils.py index 78468dff5..1108417f7 100644 --- a/ietf/stats/utils.py +++ b/ietf/stats/utils.py @@ -190,3 +190,18 @@ def clean_country_name(country_name): return country_name return "" + + +def compute_hirsch_index(citation_counts): + """Computes the h-index given a sequence containing the number of + citations for each document.""" + + i = 0 + + for count in sorted(citation_counts, reverse=True): + if i + 1 > count: + break + + i += 1 + + return i diff --git a/ietf/stats/views.py b/ietf/stats/views.py index f8e2bb305..268cc9505 100644 --- a/ietf/stats/views.py +++ b/ietf/stats/views.py @@ -536,7 +536,8 @@ def known_countries_list(request, stats_type=None, acronym=None): c.aliases = sorted(c.countryalias_set.all(), key=lambda a: a.pk) return render(request, "stats/known_countries_list.html", { - "countries": countries + "countries": countries, + "ticket_email_address": settings.SECRETARIAT_TICKET_EMAIL, }) diff --git a/ietf/templates/stats/known_countries_list.html b/ietf/templates/stats/known_countries_list.html index 2404af9ef..37f4fa8cb 100644 --- a/ietf/templates/stats/known_countries_list.html +++ b/ietf/templates/stats/known_countries_list.html @@ -9,6 +9,12 @@

{% block title %}Countries known to the Datatracker{% endblock %}

+

In case you think a country or an alias is missing from the list, you can file a ticket.

+ + {% if request.user.is_staff %} +

Note: since you're an admin, the country names are linked to their corresponding admin page.

+ {% endif %} + @@ -19,7 +25,15 @@ {% for c in countries %} - +
{{ c.name }} + {% if request.user.is_staff %} + + {% endif %} + {{ c.name }} + {% if request.user.is_staff %} + + {% endif %} + {% for a in c.aliases %} {{ a.alias }}{% if not forloop.last %},{% endif %} diff --git a/ietf/templates/submit/submission_status.html b/ietf/templates/submit/submission_status.html index d05ea0468..473829130 100644 --- a/ietf/templates/submit/submission_status.html +++ b/ietf/templates/submit/submission_status.html @@ -223,7 +223,7 @@ {% if author.country and not author.cleaned_country %}
- Unrecognized country: "{{ author.country }}": Please use a recognized country name. + Unrecognized country: "{{ author.country }}": See recognized country names. {% endif %}