Commit 18d57920 by David Ormsbee

Merge pull request #1302 from MITx/bugfix/brian/pearson-reg

Bugfix/brian/pearson reg
parents 9f33e3c7 fdd395e0
......@@ -271,8 +271,9 @@ class TestCenterUserForm(ModelForm):
new_user = self.save(commit=False)
# create additional values here:
new_user.user_updated_at = datetime.utcnow()
new_user.upload_status = ''
new_user.save()
log.info("Updated demographic information for user's test center exam registration: username \"{}\" ".format(new_user.username))
log.info("Updated demographic information for user's test center exam registration: username \"{}\" ".format(new_user.user.username))
# add validation:
......@@ -533,6 +534,7 @@ class TestCenterRegistrationForm(ModelForm):
registration = self.save(commit=False)
# create additional values here:
registration.user_updated_at = datetime.utcnow()
registration.upload_status = ''
registration.save()
log.info("Updated registration information for user's test center exam registration: username \"{}\" course \"{}\", examcode \"{}\"".format(registration.testcenter_user.user.username, registration.course_id, registration.exam_series_code))
......
......@@ -632,15 +632,18 @@ def begin_exam_registration(request, course_id):
user = request.user
try:
course = (course_from_id(course_id))
course = course_from_id(course_id)
except ItemNotFoundError:
# TODO: do more than just log!! The rest will fail, so we should fail right now.
log.error("User {0} enrolled in non-existent course {1}"
.format(user.username, course_id))
log.error("User {0} enrolled in non-existent course {1}".format(user.username, course_id))
raise Http404
# get the exam to be registered for:
# (For now, we just assume there is one at most.)
# if there is no exam now (because someone bookmarked this stupid page),
# then return a 404:
exam_info = course.current_test_center_exam
if exam_info is None:
raise Http404
# determine if the user is registered for this course:
registration = exam_registration_info(user, course)
......@@ -675,11 +678,18 @@ def create_exam_registration(request, post_override=None):
username = post_vars['username']
user = User.objects.get(username=username)
course_id = post_vars['course_id']
course = (course_from_id(course_id)) # assume it will be found....
course = course_from_id(course_id) # assume it will be found....
# make sure that any demographic data values received from the page have been stripped.
# Whitespace is not an acceptable response for any of these values
demographic_data = {}
for fieldname in TestCenterUser.user_provided_fields():
if fieldname in post_vars:
demographic_data[fieldname] = (post_vars[fieldname]).strip()
try:
testcenter_user = TestCenterUser.objects.get(user=user)
needs_updating = testcenter_user.needs_update(post_vars)
needs_updating = testcenter_user.needs_update(demographic_data)
log.info("User {0} enrolled in course {1} {2}updating demographic info for exam registration".format(user.username, course_id, "" if needs_updating else "not "))
except TestCenterUser.DoesNotExist:
# do additional initialization here:
......@@ -691,7 +701,7 @@ def create_exam_registration(request, post_override=None):
if needs_updating:
# first perform validation on the user information
# using a Django Form.
form = TestCenterUserForm(instance=testcenter_user, data=post_vars)
form = TestCenterUserForm(instance=testcenter_user, data=demographic_data)
if form.is_valid():
form.update_and_save()
else:
......
......@@ -426,6 +426,14 @@
font-size: 1.2rem;
font-weight: bold;
}
strong {
font-weight: 700;
a {
font-weight: 700;
}
}
}
.actions {
......
......@@ -232,8 +232,9 @@ $red: rgb(178, 6, 16);
}
input, textarea {
height: 100%;
width: 100%;
padding: $baseline ($baseline*.75);
padding: ($baseline/2);
&.long {
width: 100%;
......
......@@ -243,22 +243,15 @@
% endif
% if registration.is_rejected:
<div class="message message-status is-shown exam-schedule">
<p class="message-copy">Your
<a href="${testcenter_register_target}" id="exam_register_link">registration for the Pearson exam</a>
has been rejected. Please check the information you provided, and try to correct any demographic errors. Otherwise
contact edX for further help.</p>
<a href="mailto:exam-help@edx.org?subject=Pearson VUE Exam - ${get_course_about_section(course, 'university')} ${course.number}" class="button contact-button">Contact exam-help@edx.org</a>
<p class="message-copy"><strong>Your registration for the Pearson exam has been rejected. Please <a href="${testcenter_register_target}" id="exam_register_link">see your registration status details</a></strong>. Otherwise <a class="contact-link" href="mailto:exam-help@edx.org?subject=Pearson VUE Exam - ${get_course_about_section(course, 'university')} ${course.number}">contact edX at exam-help@edx.org</a> for further help.</p>
</div>
% endif
% if not registration.is_accepted and not registration.is_rejected:
<div class="message message-status is-shown">
<p class="message-copy">Your
<a href="${testcenter_register_target}" id="exam_register_link">registration for the Pearson exam</a>
is pending. Within a few days, you should see a confirmation number here, which can be used to schedule your exam.</p>
<p class="message-copy"><strong>Your <a href="${testcenter_register_target}" id="exam_register_link">registration for the Pearson exam</a> is pending</strong>. Within a few days, you should see a confirmation number here, which can be used to schedule your exam.</p>
</div>
% endif
% endif
% endif
<%
......
......@@ -128,7 +128,7 @@
% if registration.registration_is_rejected:
<section class="status message message-flash registration-rejected message-action is-shown">
<h3 class="message-title">Your registration for the Pearson exam has been rejected</h3>
<p class="message-copy">Please see your registration status details for more information.</p>
<p class="message-copy">Please see your <strong>registration status</strong> details for more information.</p>
</section>
% endif
......@@ -246,25 +246,25 @@
<li class="field-group phoneinfo">
<div class="field required" id="field-phone">
<label for="phone">Phone Number</label>
<input id="phone" type="tel" name="phone" value="${testcenteruser.phone}" placeholder="e.g. 1-55-555-5555" />
<input id="phone" type="tel" name="phone" value="${testcenteruser.phone}" />
</div>
<div class="field" id="field-extension">
<label for="extension">Extension</label>
<input id="extension" class="short" type="tel" name="extension" value="${testcenteruser.extension}" placeholder="e.g. 555" />
<input id="extension" class="short" type="tel" name="extension" value="${testcenteruser.extension}" />
</div>
<div class="field required" id="field-phone_country_code">
<label for="phone_country_code">Phone Country Code</label>
<input id="phone_country_code" class="short" type="text" name="phone_country_code" value="${testcenteruser.phone_country_code}" placeholder="e.g. 1, 44, 976" />
<input id="phone_country_code" class="short" type="text" name="phone_country_code" value="${testcenteruser.phone_country_code}" />
</div>
</li>
<li class="field-group faxinfo">
<div class="field" id="field-fax">
<label for="fax">Fax Number</label>
<input id="fax" type="tel" class="short" name="fax" value="${testcenteruser.fax}" placeholder="e.g. 1-55-555-5555" />
<input id="fax" type="tel" class="short" name="fax" value="${testcenteruser.fax}" />
</div>
<div class="field" id="field-fax_country_code">
<label for="fax_country_code">Fax Country Code</label>
<input id="fax_country_code" class="short" type="text" name="fax_country_code" value="${testcenteruser.fax_country_code}" placeholder="e.g. 1, 44, 976" />
<input id="fax_country_code" class="short" type="text" name="fax_country_code" value="${testcenteruser.fax_country_code}" />
</div>
</li>
<li class="field" id="field-company_name">
......@@ -474,7 +474,7 @@
<div class="details details-contact">
<h4>Questions</h4>
<p>If you have a specific question pertaining to your registration, you may contact <a class="contact-link" href="${exam_help_href}">exam-help@edx.org</a>.</p>
<p>If you have a specific question pertaining to your registration, you may <a class="contact-link" href="${exam_help_href}">contact edX at exam-help@edx.org</a>.</p>
</div>
</aside>
</section>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment