diff --git a/uw_sws/models.py b/uw_sws/models.py index 7dd731e..e92f918 100644 --- a/uw_sws/models.py +++ b/uw_sws/models.py @@ -106,7 +106,8 @@ class SwsPerson(models.Model): permanent_phone = models.CharField(max_length=64, null=True, blank=True) visa_type = models.CharField(max_length=2, null=True, blank=True) veteran_code = models.CharField(max_length=2) - resident_code = models.SmallIntegerField(null=True) + resident_code = models.CharField(max_length=2, null=True, blank=True) + resident_desc = models.CharField(max_length=32, null=True, blank=True) def is_veteran(self): return self.veteran_code != "0" @@ -135,9 +136,10 @@ def json_data(self): 'permanent_address': get_student_address_json( self.permanent_address), 'permanent_phone': self.permanent_phone, - 'visa_type': self.visa_type, + 'resident_desc': self.resident_desc, + 'resident_code': self.resident_code, 'veteran_code': self.veteran_code, - 'resident_code': self.resident_code + 'visa_type': self.visa_type } def __str__(self): diff --git a/uw_sws/person.py b/uw_sws/person.py index dfbdfb3..2e73fcf 100644 --- a/uw_sws/person.py +++ b/uw_sws/person.py @@ -80,5 +80,6 @@ def _process_json_data(person_data): person.uwnetid = person_data.get("UWNetID") person.visa_type = person_data.get("VisaType") person.resident_code = person_data.get("Resident") + person.resident_desc = person_data.get("ResidencyDescription") return person diff --git a/uw_sws/resources/sws/file/student/v5/person/00000000000000000000000000000001.json b/uw_sws/resources/sws/file/student/v5/person/00000000000000000000000000000001.json index 64eca9a..0db1cca 100644 --- a/uw_sws/resources/sws/file/student/v5/person/00000000000000000000000000000001.json +++ b/uw_sws/resources/sws/file/student/v5/person/00000000000000000000000000000001.json @@ -14,6 +14,7 @@ "PermanentPhone":null, "RegID":"00000000000000000000000000000001", "RegisteredName":null, + "ResidencyDescription": null, "Resident":null, "StudentName":"SYSTEM OVERHEAD", "StudentNumber":null, diff --git a/uw_sws/resources/sws/file/student/v5/person/12345678901234567890123456789012.json b/uw_sws/resources/sws/file/student/v5/person/12345678901234567890123456789012.json index 443363f..472430e 100644 --- a/uw_sws/resources/sws/file/student/v5/person/12345678901234567890123456789012.json +++ b/uw_sws/resources/sws/file/student/v5/person/12345678901234567890123456789012.json @@ -27,7 +27,8 @@ "PermanentPhone":null, "RegID":"12345678901234567890123456789012", "RegisteredName":"EIGHT STUDENT", - "Resident":"5", + "ResidencyDescription": "NONRESIDENT CITIZEN", + "Resident": "3", "StudentName":"Eight Student", "StudentNumber":"1443336", "StudentSystemKey":"000083857", diff --git a/uw_sws/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494F31.json b/uw_sws/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494F31.json index 4f079bd..fb71b05 100644 --- a/uw_sws/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494F31.json +++ b/uw_sws/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494F31.json @@ -26,7 +26,8 @@ "Zip":""}, "PermanentPhone":null, "RegID":"9136CCB8F66711D5BE060004AC494F31", - "Resident":null, + "ResidencyDescription": "NONRESIDENT STUDENT VISA", + "Resident": "5", "StudentName":"Chakrabarti,Japendra", "StudentNumber":"1233334", "StudentSystemKey":"000018235", diff --git a/uw_sws/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494FFE.json b/uw_sws/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494FFE.json index fe5c673..f67d4d2 100644 --- a/uw_sws/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494FFE.json +++ b/uw_sws/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494FFE.json @@ -26,7 +26,7 @@ "Zip":"98005-1234"}, "PermanentPhone":"2065555555", "RegID":"9136CCB8F66711D5BE060004AC494FFE", - "Resident":1, + "Resident":"1", "ResidencyDescription": "RESIDENT", "StudentName":"John Joseph Average", "StudentNumber":"1033334", diff --git a/uw_sws/tests/test_person.py b/uw_sws/tests/test_person.py index 047700f..2250b0a 100644 --- a/uw_sws/tests/test_person.py +++ b/uw_sws/tests/test_person.py @@ -51,7 +51,8 @@ def test_person_resource(self): "/student/v5/term/2013,autumn.json") self.assertEqual(data.last_enrolled.quarter, "autumn") self.assertEqual(data.last_enrolled.year, 2013) - self.assertEqual(data.resident_code, 1) + self.assertEqual(data.resident_code, "1") + self.assertEqual(data.resident_desc, "RESIDENT") def test_person_jinter(self): data = get_person_by_regid("9136CCB8F66711D5BE060004AC494F31") @@ -89,7 +90,8 @@ def test_person_jinter(self): self.assertEqual(data.permanent_address.postal_code, "400001") self.assertEqual(data.permanent_address.state, "Mumbai") self.assertEqual(data.permanent_address.zip_code, "") - self.assertIsNone(data.resident_code) + self.assertEqual(data.resident_code, "5") + self.assertEqual(data.resident_desc, "NONRESIDENT STUDENT VISA") data = get_person_by_regid("12345678901234567890123456789012") self.assertTrue(data.is_J1()) @@ -118,8 +120,15 @@ def test_person_none(self): self.assertIsNone(data.permanent_phone) self.assertIsNone(data.permanent_address) self.assertIsNone(data.resident_code) + self.assertIsNone(data.resident_desc) - def test_json_datat(self): + def test_json_data(self): data = get_person_by_regid("9136CCB8F66711D5BE060004AC494FFE") self.assertEqual(data.json_data()['email'], "javerage@u.washington.edu") + self.assertEqual(data.json_data()['resident_code'], + "1") + self.assertEqual(data.json_data()['resident_desc'], + "RESIDENT") + self.assertEqual(data.json_data()['visa_type'], + "")