diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 89e2548bbb..b7b2b4e21d 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -200,13 +200,37 @@ class TestCenterUser(models.Model): return self.user.email class TestCenterRegistration(models.Model): + """ + This is our representation of a user's registration for in-person testing, + and specifically for Pearson at this point. A few things to note: + + * Pearson only supports Latin-1, so we have to make sure that the data we + capture here will work with that encoding. This is less of an issue + than for the TestCenterUser. + * Registrations are only created here when a user registers to take an exam in person. + + The field names and lengths are modeled on the conventions and constraints + of Pearson's data import system. + """ + # TODO: Check the spec to find out lengths specified by Pearson + testcenter_user = models.ForeignKey(TestCenterUser, unique=True, default=None) created_at = models.DateTimeField(auto_now_add=True, db_index=True) updated_at = models.DateTimeField(auto_now=True, db_index=True) - accommodation_request = models.CharField(max_length=1024) - # TODO: this should be an enumeration: - accommodation_code = models.CharField(max_length=64) + course_id = models.CharField(max_length=128, db_index=True) + # store the original text of the accommodation request. + accommodation_request = models.CharField(max_length=1024, blank=True) + # TODO: this should be an enumeration: + accommodation_code = models.CharField(max_length=64, blank=True) + + @property + def candidate_id(self): + return self.testcenter_user.candidate_id + + @property + def client_candidate_id(self): + return self.testcenter_user.client_candidate_id def unique_id_for_user(user): """ diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index d972cb326c..cfb6b3a39b 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -207,11 +207,11 @@ def dashboard(request): # we want to populate the registration page with the relevant information, # if it already exists. Create an empty object otherwise. - try: - testcenteruser = TestCenterUser.objects.get(user=user) - except TestCenterUser.DoesNotExist: - testcenteruser = TestCenterUser() - testcenteruser.user = user +# try: +# testcenteruser = TestCenterUser.objects.get(user=user) +# except TestCenterUser.DoesNotExist: +# testcenteruser = TestCenterUser() +# testcenteruser.user = user # Build our courses list for the user, but ignore any courses that no longer # exist (because the course IDs have changed). Still, we don't delete those @@ -252,7 +252,8 @@ def dashboard(request): 'show_courseware_links_for' : show_courseware_links_for, 'cert_statuses': cert_statuses, 'news': top_news, - 'testcenteruser': testcenteruser, +# No longer needed here...move to begin_registration +# 'testcenteruser': testcenteruser, } return render_to_response('dashboard.html', context) @@ -692,7 +693,7 @@ def _do_create_or_update_test_center_user(post_vars): registration = TestCenterRegistration(testcenter_user = testcenter_user) # registration.register(user) - + registration.course_id = post_vars['course_id'] registration.accommodation_request = post_vars['accommodations'] return (user, testcenter_user, registration) diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index f771f3e098..c7a8df077a 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -239,7 +239,8 @@
- Schedule Pearson exam + + Schedule Pearson exam

Registration number: edx00015879548

Write this down! You’ll need it to schedule your exam.