From 25f08374caa9a40c4432222594ece10804393349 Mon Sep 17 00:00:00 2001 From: Brian Wilson Date: Tue, 8 Jan 2013 17:42:15 -0500 Subject: [PATCH] hook up more registration status boxes --- ...more_fields_to_test_center_registration.py | 208 ++++++++++++++++++ common/djangoapps/student/models.py | 140 +++++++++--- lms/templates/dashboard.html | 6 +- lms/templates/test_center_register.html | 102 ++++++++- 4 files changed, 414 insertions(+), 42 deletions(-) create mode 100644 common/djangoapps/student/migrations/0023_add_more_fields_to_test_center_registration.py diff --git a/common/djangoapps/student/migrations/0023_add_more_fields_to_test_center_registration.py b/common/djangoapps/student/migrations/0023_add_more_fields_to_test_center_registration.py new file mode 100644 index 0000000000..adcf5e6d66 --- /dev/null +++ b/common/djangoapps/student/migrations/0023_add_more_fields_to_test_center_registration.py @@ -0,0 +1,208 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'TestCenterUser.processed_at' + db.add_column('student_testcenteruser', 'processed_at', + self.gf('django.db.models.fields.DateTimeField')(null=True, db_index=True), + keep_default=False) + + # Adding field 'TestCenterUser.confirmed_at' + db.add_column('student_testcenteruser', 'confirmed_at', + self.gf('django.db.models.fields.DateTimeField')(null=True, db_index=True), + keep_default=False) + + # Adding field 'TestCenterRegistration.processed_at' + db.add_column('student_testcenterregistration', 'processed_at', + self.gf('django.db.models.fields.DateTimeField')(null=True, db_index=True), + keep_default=False) + + # Adding field 'TestCenterRegistration.authorization_id' + db.add_column('student_testcenterregistration', 'authorization_id', + self.gf('django.db.models.fields.IntegerField')(null=True, db_index=True), + keep_default=False) + + # Adding field 'TestCenterRegistration.confirmed_at' + db.add_column('student_testcenterregistration', 'confirmed_at', + self.gf('django.db.models.fields.DateTimeField')(null=True, db_index=True), + keep_default=False) + + # Adding index on 'TestCenterRegistration', fields ['accommodation_request'] + db.create_index('student_testcenterregistration', ['accommodation_request']) + + # Adding index on 'TestCenterRegistration', fields ['upload_status'] + db.create_index('student_testcenterregistration', ['upload_status']) + + + def backwards(self, orm): + # Removing index on 'TestCenterRegistration', fields ['upload_status'] + db.delete_index('student_testcenterregistration', ['upload_status']) + + # Removing index on 'TestCenterRegistration', fields ['accommodation_request'] + db.delete_index('student_testcenterregistration', ['accommodation_request']) + + # Deleting field 'TestCenterUser.processed_at' + db.delete_column('student_testcenteruser', 'processed_at') + + # Deleting field 'TestCenterUser.confirmed_at' + db.delete_column('student_testcenteruser', 'confirmed_at') + + # Deleting field 'TestCenterRegistration.processed_at' + db.delete_column('student_testcenterregistration', 'processed_at') + + # Deleting field 'TestCenterRegistration.authorization_id' + db.delete_column('student_testcenterregistration', 'authorization_id') + + # Deleting field 'TestCenterRegistration.confirmed_at' + db.delete_column('student_testcenterregistration', 'confirmed_at') + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'student.courseenrollment': { + 'Meta': {'unique_together': "(('user', 'course_id'),)", 'object_name': 'CourseEnrollment'}, + 'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + }, + 'student.pendingemailchange': { + 'Meta': {'object_name': 'PendingEmailChange'}, + 'activation_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'new_email': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'}) + }, + 'student.pendingnamechange': { + 'Meta': {'object_name': 'PendingNameChange'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'new_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'rationale': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'}) + }, + 'student.registration': { + 'Meta': {'object_name': 'Registration', 'db_table': "'auth_registration'"}, + 'activation_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'}) + }, + 'student.testcenterregistration': { + 'Meta': {'object_name': 'TestCenterRegistration'}, + 'accommodation_code': ('django.db.models.fields.CharField', [], {'max_length': '64', 'blank': 'True'}), + 'accommodation_request': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '1024', 'blank': 'True'}), + 'authorization_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'db_index': 'True'}), + 'client_authorization_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '20', 'db_index': 'True'}), + 'confirmed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}), + 'course_id': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), + 'eligibility_appointment_date_first': ('django.db.models.fields.DateField', [], {'db_index': 'True'}), + 'eligibility_appointment_date_last': ('django.db.models.fields.DateField', [], {'db_index': 'True'}), + 'exam_series_code': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'processed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}), + 'testcenter_user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['student.TestCenterUser']"}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), + 'upload_error_message': ('django.db.models.fields.CharField', [], {'max_length': '512', 'blank': 'True'}), + 'upload_status': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '20', 'blank': 'True'}), + 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}), + 'user_updated_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}) + }, + 'student.testcenteruser': { + 'Meta': {'object_name': 'TestCenterUser'}, + 'address_1': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'address_2': ('django.db.models.fields.CharField', [], {'max_length': '40', 'blank': 'True'}), + 'address_3': ('django.db.models.fields.CharField', [], {'max_length': '40', 'blank': 'True'}), + 'candidate_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'db_index': 'True'}), + 'city': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), + 'client_candidate_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}), + 'company_name': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}), + 'confirmed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}), + 'country': ('django.db.models.fields.CharField', [], {'max_length': '3', 'db_index': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), + 'extension': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '8', 'blank': 'True'}), + 'fax': ('django.db.models.fields.CharField', [], {'max_length': '35', 'blank': 'True'}), + 'fax_country_code': ('django.db.models.fields.CharField', [], {'max_length': '3', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'db_index': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), + 'middle_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'phone': ('django.db.models.fields.CharField', [], {'max_length': '35'}), + 'phone_country_code': ('django.db.models.fields.CharField', [], {'max_length': '3', 'db_index': 'True'}), + 'postal_code': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '16', 'blank': 'True'}), + 'processed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}), + 'salutation': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}), + 'state': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '20', 'blank': 'True'}), + 'suffix': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), + 'upload_error_message': ('django.db.models.fields.CharField', [], {'max_length': '512', 'blank': 'True'}), + 'upload_status': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '20', 'blank': 'True'}), + 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['auth.User']", 'unique': 'True'}), + 'user_updated_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}) + }, + 'student.userprofile': { + 'Meta': {'object_name': 'UserProfile', 'db_table': "'auth_userprofile'"}, + 'courseware': ('django.db.models.fields.CharField', [], {'default': "'course.xml'", 'max_length': '255', 'blank': 'True'}), + 'gender': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '6', 'null': 'True', 'blank': 'True'}), + 'goals': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'language': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), + 'level_of_education': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '6', 'null': 'True', 'blank': 'True'}), + 'location': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), + 'mailing_address': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'meta': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}), + 'year_of_birth': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}) + }, + 'student.usertestgroup': { + 'Meta': {'object_name': 'UserTestGroup'}, + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}), + 'users': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'db_index': 'True', 'symmetrical': 'False'}) + } + } + + complete_apps = ['student'] \ No newline at end of file diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 2392a92d3a..955876eb66 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -131,6 +131,9 @@ class UserProfile(models.Model): def set_meta(self, js): self.meta = json.dumps(js) +TEST_CENTER_STATUS_ACCEPTED = "Accepted" +TEST_CENTER_STATUS_ERROR = "Error" + class TestCenterUser(models.Model): """This is our representation of the User for in-person testing, and specifically for Pearson at this point. A few things to note: @@ -159,10 +162,6 @@ class TestCenterUser(models.Model): # updated_at, this will not get incremented when we do a batch data import. user_updated_at = models.DateTimeField(db_index=True) - # Unique ID given to us for this User by the Testing Center. It's null when - # we first create the User entry, and is assigned by Pearson later. - candidate_id = models.IntegerField(null=True, db_index=True) - # Unique ID we assign our user for the Test Center. client_candidate_id = models.CharField(unique=True, max_length=50, db_index=True) @@ -197,10 +196,21 @@ class TestCenterUser(models.Model): # Company company_name = models.CharField(max_length=50, blank=True, db_index=True) - # Confirmation - upload_status = models.CharField(max_length=20, blank=True, db_index=True) # 'Error' or 'Accepted' + # time at which edX sent the registration to the test center uploaded_at = models.DateTimeField(null=True, blank=True, db_index=True) + + # confirmation back from the test center, as well as timestamps + # on when they processed the request, and when we received + # confirmation back. + processed_at = models.DateTimeField(null=True, db_index=True) + upload_status = models.CharField(max_length=20, blank=True, db_index=True) # 'Error' or 'Accepted' upload_error_message = models.CharField(max_length=512, blank=True) + # Unique ID given to us for this User by the Testing Center. It's null when + # we first create the User entry, and may be assigned by Pearson later. + # (However, it may never be set if we are always initiating such candidate creation.) + candidate_id = models.IntegerField(null=True, db_index=True) + confirmed_at = models.DateTimeField(null=True, db_index=True) + @staticmethod def user_provided_fields(): @@ -237,14 +247,17 @@ class TestCenterUser(models.Model): testcenter_user.client_candidate_id = cand_id return testcenter_user + @property def is_accepted(self): - return self.upload_status == 'Accepted' + return self.upload_status == TEST_CENTER_STATUS_ACCEPTED + @property def is_rejected(self): - return self.upload_status == 'Error' + return self.upload_status == TEST_CENTER_STATUS_ERROR + @property def is_pending(self): - return self.upload_status == '' + return not self.is_accepted and not self.is_rejected class TestCenterUserForm(ModelForm): class Meta: @@ -313,19 +326,21 @@ class TestCenterUserForm(ModelForm): # Always return the full collection of cleaned data. return cleaned_data - +# our own code to indicate that a request has been rejected. +ACCOMMODATION_REJECTED_CODE = 'NONE' ACCOMODATION_CODES = ( + (ACCOMMODATION_REJECTED_CODE, 'No Accommodation Granted'), ('EQPMNT', 'Equipment'), ('ET12ET', 'Extra Time - 1/2 Exam Time'), ('ET30MN', 'Extra Time - 30 Minutes'), ('ETDBTM', 'Extra Time - Double Time'), ('SEPRMM', 'Separate Room'), - ('SRREAD', 'Separate Room & Reader'), - ('SRRERC', 'Separate Room & Reader/Recorder'), - ('SRRECR', 'Separate Room & Recorder'), - ('SRSEAN', 'Separate Room & Service Animal'), - ('SRSGNR', 'Separate Room & Sign Lang Interp'), + ('SRREAD', 'Separate Room and Reader'), + ('SRRERC', 'Separate Room and Reader/Recorder'), + ('SRRECR', 'Separate Room and Recorder'), + ('SRSEAN', 'Separate Room and Service Animal'), + ('SRSGNR', 'Separate Room and Sign Language Interpreter'), ) class TestCenterRegistration(models.Model): @@ -355,7 +370,7 @@ class TestCenterRegistration(models.Model): # The appointment dates, the exam count, and the accommodation codes can be updated, # but hopefully this won't happen often. user_updated_at = models.DateTimeField(db_index=True) - # "client_authorization_id" is the client's unique identifier for the authorization. + # "client_authorization_id" is our unique identifier for the authorization. # This must be present for an update or delete to be sent to Pearson. client_authorization_id = models.CharField(max_length=20, unique=True, db_index=True) @@ -365,17 +380,28 @@ class TestCenterRegistration(models.Model): eligibility_appointment_date_last = models.DateField(db_index=True) # this is really a list of codes, using an '*' as a delimiter. - # So it's not a choice list. + # So it's not a choice list. We use the special value of ACCOMMODATION_REJECTED_CODE + # to indicate the rejection of an accommodation request. accommodation_code = models.CharField(max_length=64, blank=True) # store the original text of the accommodation request. - accommodation_request = models.CharField(max_length=1024, blank=True) + accommodation_request = models.CharField(max_length=1024, blank=True, db_index=True) - # Confirmation - upload_status = models.CharField(max_length=20, blank=True) # 'Error' or 'Accepted' + # time at which edX sent the registration to the test center uploaded_at = models.DateTimeField(null=True, db_index=True) - upload_error_message = models.CharField(max_length=512, blank=True) + # confirmation back from the test center, as well as timestamps + # on when they processed the request, and when we received + # confirmation back. + processed_at = models.DateTimeField(null=True, db_index=True) + upload_status = models.CharField(max_length=20, blank=True, db_index=True) # 'Error' or 'Accepted' + upload_error_message = models.CharField(max_length=512, blank=True) + # Unique ID given to us for this registration by the Testing Center. It's null when + # we first create the registration entry, and may be assigned by Pearson later. + # (However, it may never be set if we are always initiating such candidate creation.) + authorization_id = models.IntegerField(null=True, db_index=True) + confirmed_at = models.DateTimeField(null=True, db_index=True) + @property def candidate_id(self): return self.testcenter_user.candidate_id @@ -389,11 +415,11 @@ class TestCenterRegistration(models.Model): registration = TestCenterRegistration(testcenter_user = testcenter_user) registration.course_id = exam.course_id registration.accommodation_request = accommodation_request - registration.exam_series_code = exam.exam_series_code # .get('Exam_Series_Code') + registration.exam_series_code = exam.exam_series_code registration.eligibility_appointment_date_first = strftime("%Y-%m-%d", exam.first_eligible_appointment_date) registration.eligibility_appointment_date_last = strftime("%Y-%m-%d", exam.last_eligible_appointment_date) - # accommodation_code remains blank for now, along with Pearson confirmation - registration.client_authorization_id = registration._create_client_authorization_id() + registration.client_authorization_id = TestCenterRegistration._create_client_authorization_id() + # accommodation_code remains blank for now, along with Pearson confirmation information return registration @staticmethod @@ -402,7 +428,8 @@ class TestCenterRegistration(models.Model): return u"edX%0d" % randint(1, 10**NUM_DIGITS-1) # binascii.hexlify(os.urandom(8)) - def _create_client_authorization_id(self): + @staticmethod + def _create_client_authorization_id(): """ Return a unique id for a registration, suitable for using as an authorization code for Pearson. It must fit within 20 characters. @@ -413,17 +440,68 @@ class TestCenterRegistration(models.Model): auth_id = TestCenterRegistration._generate_authorization_id() return auth_id - def is_accepted(self): - return self.upload_status == 'Accepted' and self.testcenter_user.is_accepted() + # methods for providing registration status details on registration page: + @property + def demographics_is_accepted(self): + return self.testcenter_user.is_accepted + + @property + def demographics_is_rejected(self): + return self.testcenter_user.is_rejected + + @property + def demographics_is_pending(self): + return self.testcenter_user.is_pending + + @property + def accommodation_is_accepted(self): + return len(self.accommodation_request) > 0 and len(self.accommodation_code) > 0 and self.accommodation_code != ACCOMMODATION_REJECTED_CODE + + @property + def accommodation_is_rejected(self): + return len(self.accommodation_request) > 0 and self.accommodation_code == ACCOMMODATION_REJECTED_CODE + + @property + def accommodation_is_pending(self): + return len(self.accommodation_request) > 0 and len(self.accommodation_code) == 0 + + @property + def accommodation_is_skipped(self): + return len(self.accommodation_request) == 0 + + @property + def registration_is_accepted(self): + return self.upload_status == TEST_CENTER_STATUS_ACCEPTED - def is_rejected(self): - return self.upload_status == 'Error' or self.testcenter_user.is_rejected() + @property + def registration_is_rejected(self): + return self.upload_status == TEST_CENTER_STATUS_ERROR + @property + def registration_is_pending(self): + return not self.registration_is_accepted and not self.registration_is_rejected + + # methods for providing registration status summary on dashboard page: + @property + def is_accepted(self): + return self.registration_is_accepted and self.demographics_is_accepted + + @property + def is_rejected(self): + return self.registration_is_rejected or self.demographics_is_rejected + + @property + def is_pending(self): + return not self.is_accepted and not self.is_rejected + + @property def is_pending_accommodation(self): - return len(self.accommodation_request) > 0 and self.accommodation_code == '' + return self.accommodation_is_pending + @property def is_pending_acknowledgement(self): - return (self.upload_status == '' or self.testcenter_user.is_pending()) and not self.is_pending_accommodation() + return (not self.is_accepted and not self.is_rejected) and not self.is_pending_accommodation + class TestCenterRegistrationForm(ModelForm): class Meta: diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index ab31de1aed..c210f6e7be 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -234,7 +234,7 @@ % endif % if registration is not None: - % if registration.is_accepted(): + % if registration.is_accepted:
Schedule Pearson exam @@ -242,7 +242,7 @@

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

% endif - % if registration.is_rejected(): + % if registration.is_rejected:
Contact exam-help@edx.org @@ -253,7 +253,7 @@
% endif - % if not registration.is_accepted() and not registration.is_rejected(): + % if not registration.is_accepted and not registration.is_rejected:

Your registration for the Pearson exam diff --git a/lms/templates/test_center_register.html b/lms/templates/test_center_register.html index 09f25fbb65..f972599b7a 100644 --- a/lms/templates/test_center_register.html +++ b/lms/templates/test_center_register.html @@ -103,25 +103,29 @@ % if registration: - + % if registration.is_rejected:

Your registration for the Pearson exam has been rejected

Please check the information you provided, and try to correct any demographic errors. Otherwise contact someone at edX or Pearson, or just scream for help.

Contact exam-help@edx.org
+ % endif - + % if registration.is_accepted:

Your registration for the Pearson exam has been processed

-

Your registration number is 12345678901 (Write this down! You’ll need it to schedule your exam.)

+

Your registration number is ${registration.client_authorization_id} (Write this down! You’ll need it to schedule your exam.)

Schedule Pearson exam
+ % endif - + % if registration.is_pending:

Your registration for the Pearson exam is pending

Once your information is processed, it will be forwarded to Pearson and you will be able to schedule an exam.

+ % endif + % endif
@@ -141,10 +145,10 @@ % endif - - - - + + + +
@@ -312,6 +316,88 @@