Repository: ietf-tools/datatracker

Issue:
fetch_meeting_attendance doesn't update the reg_type or ticket_type fields
The synchronization backstop (run daily) for keeping MeetingRegistration in sync with the registration system doesn't actually synchronize the reg_type and ticket_type fields.
fetch_meeting_attendance doesn't update the reg_type or ticket_type fields
The synchronization backstop (run daily) for keeping MeetingRegistration in sync with the registration system doesn't actually synchronize the reg_type and ticket_type fields.


Discussion:

Resolving patch:
diff --git a/ietf/stats/migrations/0005_meetingregistration_checkedin.py b/ietf/stats/migrations/0005_meetingregistration_checkedin.py
new file mode 100644
--- /dev/null
+++ b/ietf/stats/migrations/0005_meetingregistration_checkedin.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.2.28 on 2022-07-26 08:37
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('stats', '0004_split_records'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='meetingregistration',
+            name='checkedin',
+            field=models.BooleanField(default=False),
+        ),
+    ]
diff --git a/ietf/stats/models.py b/ietf/stats/models.py
--- a/ietf/stats/models.py
+++ b/ietf/stats/models.py
@@ -62,6 +62,7 @@ class MeetingRegistration(models.Model):
     reg_type = models.CharField(blank=True, max_length=255)
     ticket_type = models.CharField(blank=True, max_length=255)
     attended = models.BooleanField(default=False)
+    checkedin = models.BooleanField(default=False)
 
     def __str__(self):
         return "{} {}".format(self.first_name, self.last_name)
diff --git a/ietf/stats/utils.py b/ietf/stats/utils.py
--- a/ietf/stats/utils.py
+++ b/ietf/stats/utils.py
@@ -261,6 +261,9 @@ def get_meeting_registration_data(meeting):
             country_code    = registration['Country'].strip()
             address         = registration['Email'].strip()
             reg_type        = registration['RegType'].strip()
+            ticket_type     = registration['TicketType'].strip()
+            checkedin       = registration['CheckedIn'].strip()
+
             if (address, reg_type) in meeting_registrations:
                 object = meeting_registrations.pop((address, reg_type))
                 created = False
@@ -274,11 +277,15 @@ def get_meeting_registration_data(meeting):
             if (object.first_name != first_name[:200] or
                 object.last_name != last_name[:200] or
                 object.affiliation != affiliation or
-                object.country_code != country_code):
+                object.country_code != country_code or
+                object.ticket_type != ticket_type or
+                object.checkedin != checkedin):
                     object.first_name=first_name[:200]
                     object.last_name=last_name[:200]
                     object.affiliation=affiliation
                     object.country_code=country_code
+                    object.ticket_type=ticket_type
+                    object.checkedin=checkedin
                     object.save()
 
             # Add a Person object to MeetingRegistration object


Test patch:
diff --git a/ietf/stats/tests.py b/ietf/stats/tests.py
--- a/ietf/stats/tests.py
+++ b/ietf/stats/tests.py
@@ -237,7 +237,9 @@ def test_get_meeting_registration_data(self, mock_get):
             'Company': 'ABC',
             'Country': 'US',
             'Email': person.email().address,
-            'RegType': 'onsite'
+            'RegType': 'onsite',
+            'TicketType': 'week_pass',
+            'CheckedIn': 'True',
         }
         data2 = data.copy()
         data2['RegType'] = 'hackathon'
@@ -259,6 +261,9 @@ def test_get_meeting_registration_data(self, mock_get):
         self.assertEqual(query.count(), 2)
         self.assertEqual(query.filter(reg_type='onsite').count(), 1)
         self.assertEqual(query.filter(reg_type='hackathon').count(), 1)
+        onsite = query.get(reg_type='onsite')
+        self.assertEqual(onsite.ticket_type, 'week_pass')
+        self.assertEqual(onsite.checkedin, True)
         # call a second time to test delete
         get_meeting_registration_data(meeting)
         query = MeetingRegistration.objects.filter(meeting=meeting, email=person.email())