Skip to content

Commit a2b8819

Browse files
committed
Add meeting statistics - overview and country/continent across
meetings + detail pages with country and continent - Legacy-Id: 13264
1 parent 07c6504 commit a2b8819

File tree

13 files changed

+504
-49
lines changed

13 files changed

+504
-49
lines changed

ietf/bin/fetch-meeting-registration-data

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import syslog
2525

2626
from ietf.meeting.models import Meeting
2727

28-
from ietf.stats.utils import get_registration_data
28+
from ietf.stats.utils import get_meeting_registration_data
2929

3030
meetings = Meeting.objects.none()
3131
if args.meeting:
@@ -39,7 +39,7 @@ else:
3939
sys.exit(1)
4040

4141
for meeting in meetings:
42-
total = get_registration_data(meeting)
42+
total = get_meeting_registration_data(meeting)
4343
msg = "Fetched data for meeting {}: {} registrations added".format(meeting.number, total)
4444
if sys.stdout.isatty():
4545
print(msg) # make debugging a bit easier
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $(document).ready(function () {
1414

1515
var chart = Highcharts.chart('chart', window.chartConf);
1616
}
17-
17+
/*
1818
$(".popover-details").each(function () {
1919
var stdNameRegExp = new RegExp("^(rfc|bcp|fyi|std)[0-9]+$", 'i');
2020
var draftRegExp = new RegExp("^draft-", 'i');
@@ -49,5 +49,5 @@ $(document).ready(function () {
4949
}).on("click", function (e) {
5050
e.preventDefault();
5151
});
52-
});
52+
});*/
5353
});

ietf/stats/migrations/0003_registration_registrationstats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ class Migration(migrations.Migration):
1616

1717
operations = [
1818
migrations.CreateModel(
19-
name='Registration',
19+
name='MeetingRegistration',
2020
fields=[
2121
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
2222
('first_name', models.CharField(max_length=255)),
2323
('last_name', models.CharField(max_length=255)),
2424
('affiliation', models.CharField(blank=True, max_length=255)),
25-
('country', models.CharField(max_length=2)),
25+
('country_code', models.CharField(max_length=2)),
2626
('meeting', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='meeting.Meeting')),
2727
('person', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='person.Person')),
2828
],

ietf/stats/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ def __unicode__(self):
4242
class Meta:
4343
verbose_name_plural = "country aliases"
4444

45-
class Registration(models.Model):
45+
class MeetingRegistration(models.Model):
4646
"""Registration attendee records from the IETF registration system"""
4747
meeting = models.ForeignKey(Meeting)
4848
first_name = models.CharField(max_length=255)
4949
last_name = models.CharField(max_length=255)
5050
affiliation = models.CharField(blank=True, max_length=255)
51-
country = models.CharField(max_length=2) # ISO 3166
51+
country_code = models.CharField(max_length=2) # ISO 3166
5252
person = models.ForeignKey(Person, blank=True, null=True)
5353

5454
def __unicode__(self):

ietf/stats/tests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
from ietf.utils.test_data import make_test_data, make_review_data
1010
from ietf.utils.test_utils import login_testing_unauthorized, TestCase, unicontent
11-
from ietf.stats.models import Registration
12-
from ietf.stats.utils import get_registration_data
11+
from ietf.stats.models import MeetingRegistration
12+
from ietf.stats.utils import get_meeting_registration_data
1313
import ietf.stats.views
1414

1515
from ietf.submit.models import Submission
@@ -154,12 +154,12 @@ def test_review_stats(self):
154154
self.assertTrue(q('.review-stats td:contains("1")'))
155155

156156
@patch('requests.get')
157-
def test_get_registration_data(self, mock_get):
157+
def test_get_meeting_registration_data(self, mock_get):
158158
response = Response()
159159
response.status_code = 200
160160
response._content = '[{"LastName":"Smith","FirstName":"John","Company":"ABC","Country":"US"}]'
161161
mock_get.return_value = response
162162
meeting = MeetingFactory(type_id='ietf', date=datetime.date(2016,7,14), number="96")
163-
get_registration_data(meeting)
164-
query = Registration.objects.filter(first_name='John',last_name='Smith',country='US')
165-
self.assertTrue(query.count(),1)
163+
get_meeting_registration_data(meeting)
164+
query = MeetingRegistration.objects.filter(first_name='John',last_name='Smith',country_code='US')
165+
self.assertTrue(query.count(), 1)

ietf/stats/urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77
url("^$", views.stats_index),
88
url("^document/(?:(?P<stats_type>authors|pages|words|format|formlang|author/(?:documents|affiliation|country|continent|citations|hindex)|yearly/(?:affiliation|country|continent))/)?$", views.document_stats),
99
url("^knowncountries/$", views.known_countries_list),
10+
url("^meeting/(?P<num>\d+)/(?P<stats_type>country|continent)/$", views.meeting_stats),
11+
url("^meeting/(?:(?P<stats_type>overview|country|continent)/)?$", views.meeting_stats),
1012
url("^review/(?:(?P<stats_type>completion|results|states|time)/)?(?:%(acronym)s/)?$" % settings.URL_REGEXPS, views.review_stats),
1113
]

ietf/stats/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.conf import settings
66

7-
from ietf.stats.models import AffiliationAlias, AffiliationIgnoredEnding, CountryAlias, Registration
7+
from ietf.stats.models import AffiliationAlias, AffiliationIgnoredEnding, CountryAlias, MeetingRegistration
88
from ietf.name.models import CountryName
99

1010
def compile_affiliation_ending_stripping_regexp():
@@ -210,7 +210,7 @@ def compute_hirsch_index(citation_counts):
210210
return i
211211

212212

213-
def get_registration_data(meeting):
213+
def get_meeting_registration_data(meeting):
214214
""""Retrieve registration attendee data and summary statistics. Returns number
215215
of Registration records created."""
216216
num_created = 0
@@ -223,12 +223,12 @@ def get_registration_data(meeting):
223223
pass
224224

225225
for registration in decoded:
226-
object, created = Registration.objects.get_or_create(
226+
object, created = MeetingRegistration.objects.get_or_create(
227227
meeting_id=meeting.pk,
228228
first_name=registration['FirstName'],
229229
last_name=registration['LastName'],
230230
affiliation=registration['Company'],
231-
country=registration['Country'])
231+
country_code=registration['Country'])
232232
if created:
233233
num_created += 1
234234
return num_created

0 commit comments

Comments
 (0)