Changed most instances of 'registrations' to 'attendees' in the meeting statistics code (as that's what the numbers show)

- Legacy-Id: 13486
This commit is contained in:
Henrik Levkowetz 2017-06-01 20:17:16 +00:00
parent b6b45166bf
commit 64b9615aa7
6 changed files with 33 additions and 33 deletions

View file

@ -34,7 +34,7 @@ class StatisticsTests(TestCase):
rev=draft.rev,
words=4000,
draft=draft,
file_types="txt",
file_types=".txt",
state_id="posted",
)

View file

@ -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)

View file

@ -23,7 +23,7 @@
<div class="stats-options well">
<div>
Registrations:
Attendees:
<div class="btn-group">
{% for slug, label, url in possible_stats_types %}

View file

@ -23,7 +23,7 @@
},
yAxis: {
title: {
text: 'Number of registrations'
text: 'Number of attendees'
}
},
tooltip: {
@ -48,8 +48,8 @@
<thead>
<tr>
<th>Continent</th>
<th>Percentage of registrations</th>
<th>Registrations</th>
<th>Percentage of attendees</th>
<th>Attendees</th>
</tr>
</thead>
<tbody>

View file

@ -23,7 +23,7 @@
},
yAxis: {
title: {
text: 'Number of registrations'
text: 'Number of attendees'
}
},
tooltip: {
@ -78,8 +78,8 @@
<thead>
<tr>
<th>Country</th>
<th>Percentage of registrations</th>
<th>Registrations</th>
<th>Percentage of attendees</th>
<th>Attendees</th>
</tr>
</thead>
<tbody>

View file

@ -35,7 +35,7 @@
yAxis: {
min: 0,
title: {
text: 'Registrations at meeting'
text: 'Attendees at meeting'
}
},
tooltip: {
@ -61,7 +61,7 @@
<thead>
<tr>
<th>Meeting</th>
<th>Registrations</th>
<th>Attendees</th>
</tr>
</thead>
<tbody>