From 64b9615aa7e2ac721e7485dd330fa74563475ad8 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Thu, 1 Jun 2017 20:17:16 +0000 Subject: [PATCH] Changed most instances of 'registrations' to 'attendees' in the meeting statistics code (as that's what the numbers show) - Legacy-Id: 13486 --- ietf/stats/tests.py | 2 +- ietf/stats/views.py | 46 +++++++++---------- ietf/templates/stats/meeting_stats.html | 2 +- .../stats/meeting_stats_continent.html | 6 +-- .../stats/meeting_stats_country.html | 6 +-- .../stats/meeting_stats_overview.html | 4 +- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ietf/stats/tests.py b/ietf/stats/tests.py index 42a067d87..ad30b4ef3 100644 --- a/ietf/stats/tests.py +++ b/ietf/stats/tests.py @@ -34,7 +34,7 @@ class StatisticsTests(TestCase): rev=draft.rev, words=4000, draft=draft, - file_types="txt", + file_types=".txt", state_id="posted", ) diff --git a/ietf/stats/views.py b/ietf/stats/views.py index 549f74bae..1f5f3d28f 100644 --- a/ietf/stats/views.py +++ b/ietf/stats/views.py @@ -775,10 +775,10 @@ def meeting_stats(request, num=None, stats_type=None): bin_size = 1 eu_countries = None - def get_country_mapping(registrations): + def get_country_mapping(attendees): return { alias.alias: alias.country - for alias in CountryAlias.objects.filter(alias__in=set(r.country_code for r in registrations)).select_related("country", "country__continent") + for alias in CountryAlias.objects.filter(alias__in=set(r.country_code for r in attendees)).select_related("country", "country__continent") if alias.alias.isupper() } @@ -786,19 +786,19 @@ def meeting_stats(request, num=None, stats_type=None): return email.utils.formataddr(((r.first_name + u" " + r.last_name).strip(), r.email)) if meeting and any(stats_type == t[0] for t in possible_stats_types): - registrations = MeetingRegistration.objects.filter(meeting=meeting) + attendees = MeetingRegistration.objects.filter(meeting=meeting) if stats_type == "country": - stats_title = "Number of registrations for {} {} per country".format(meeting.type.name, meeting.number) + stats_title = "Number of attendees for {} {} per country".format(meeting.type.name, meeting.number) bins = defaultdict(set) - country_mapping = get_country_mapping(registrations) + country_mapping = get_country_mapping(attendees) eu_name = "EU" eu_countries = set(CountryName.objects.filter(in_eu=True)) - for r in registrations: + for r in attendees: name = reg_name(r) c = country_mapping.get(r.country_code) bins[c.name if c else ""].add(name) @@ -807,11 +807,11 @@ def meeting_stats(request, num=None, stats_type=None): bins[eu_name].add(name) prune_unknown_bin_with_known(bins) - total_registrations = count_bins(bins) + total_attendees = count_bins(bins) series_data = [] for country, names in sorted(bins.iteritems(), key=lambda t: t[0].lower()): - percentage = len(names) * 100.0 / (total_registrations or 1) + percentage = len(names) * 100.0 / (total_attendees or 1) if country: series_data.append((country, len(names))) table_data.append((country, percentage, names)) @@ -829,23 +829,23 @@ def meeting_stats(request, num=None, stats_type=None): chart_data.append({ "data": series_data }) elif stats_type == "continent": - stats_title = "Number of registrations for {} {} per continent".format(meeting.type.name, meeting.number) + stats_title = "Number of attendees for {} {} per continent".format(meeting.type.name, meeting.number) bins = defaultdict(set) - country_mapping = get_country_mapping(registrations) + country_mapping = get_country_mapping(attendees) - for r in registrations: + for r in attendees: name = reg_name(r) c = country_mapping.get(r.country_code) bins[c.continent.name if c else ""].add(name) prune_unknown_bin_with_known(bins) - total_registrations = count_bins(bins) + total_attendees = count_bins(bins) series_data = [] for continent, names in sorted(bins.iteritems(), key=lambda t: t[0].lower()): - percentage = len(names) * 100.0 / (total_registrations or 1) + percentage = len(names) * 100.0 / (total_attendees or 1) if continent: series_data.append((continent, len(names))) table_data.append((continent, percentage, names)) @@ -858,14 +858,14 @@ def meeting_stats(request, num=None, stats_type=None): elif not meeting and any(stats_type == t[0] for t in possible_stats_types): template_name = "overview" - registrations = MeetingRegistration.objects.filter(meeting__type="ietf").select_related('meeting') + attendees = MeetingRegistration.objects.filter(meeting__type="ietf").select_related('meeting') if stats_type == "overview": - stats_title = "Number of registrations per meeting" + stats_title = "Number of attendees per meeting" bins = defaultdict(set) - for r in registrations: + for r in attendees: meeting_number = int(r.meeting.number) name = reg_name(r) @@ -883,20 +883,20 @@ def meeting_stats(request, num=None, stats_type=None): series_data.sort(key=lambda t: t[0]) table_data.sort(key=lambda t: t[0], reverse=True) - chart_data.append({ "name": "Registrations", "data": series_data }) + chart_data.append({ "name": "Attendees", "data": series_data }) elif stats_type == "country": - stats_title = "Number of registrations per country across meetings" + stats_title = "Number of attendees per country across meetings" - country_mapping = get_country_mapping(registrations) + country_mapping = get_country_mapping(attendees) eu_name = "EU" eu_countries = set(CountryName.objects.filter(in_eu=True)) bins = defaultdict(set) - for r in registrations: + for r in attendees: meeting_number = int(r.meeting.number) name = reg_name(r) c = country_mapping.get(r.country_code) @@ -910,13 +910,13 @@ def meeting_stats(request, num=None, stats_type=None): elif stats_type == "continent": - stats_title = "Number of registrations per country across meetings" + stats_title = "Number of attendees per continent across meetings" - country_mapping = get_country_mapping(registrations) + country_mapping = get_country_mapping(attendees) bins = defaultdict(set) - for r in registrations: + for r in attendees: meeting_number = int(r.meeting.number) name = reg_name(r) c = country_mapping.get(r.country_code) diff --git a/ietf/templates/stats/meeting_stats.html b/ietf/templates/stats/meeting_stats.html index 1c359215f..c79c67e57 100644 --- a/ietf/templates/stats/meeting_stats.html +++ b/ietf/templates/stats/meeting_stats.html @@ -23,7 +23,7 @@
- Registrations: + Attendees:
{% for slug, label, url in possible_stats_types %} diff --git a/ietf/templates/stats/meeting_stats_continent.html b/ietf/templates/stats/meeting_stats_continent.html index 436507f8b..3d7784bbe 100644 --- a/ietf/templates/stats/meeting_stats_continent.html +++ b/ietf/templates/stats/meeting_stats_continent.html @@ -23,7 +23,7 @@ }, yAxis: { title: { - text: 'Number of registrations' + text: 'Number of attendees' } }, tooltip: { @@ -48,8 +48,8 @@ Continent - Percentage of registrations - Registrations + Percentage of attendees + Attendees diff --git a/ietf/templates/stats/meeting_stats_country.html b/ietf/templates/stats/meeting_stats_country.html index dc42e0086..aa852dce8 100644 --- a/ietf/templates/stats/meeting_stats_country.html +++ b/ietf/templates/stats/meeting_stats_country.html @@ -23,7 +23,7 @@ }, yAxis: { title: { - text: 'Number of registrations' + text: 'Number of attendees' } }, tooltip: { @@ -78,8 +78,8 @@ Country - Percentage of registrations - Registrations + Percentage of attendees + Attendees diff --git a/ietf/templates/stats/meeting_stats_overview.html b/ietf/templates/stats/meeting_stats_overview.html index 0a44da90b..d51d29fd0 100644 --- a/ietf/templates/stats/meeting_stats_overview.html +++ b/ietf/templates/stats/meeting_stats_overview.html @@ -35,7 +35,7 @@ yAxis: { min: 0, title: { - text: 'Registrations at meeting' + text: 'Attendees at meeting' } }, tooltip: { @@ -61,7 +61,7 @@ Meeting - Registrations + Attendees