Commit dc0e3d04 by Diana Huang

Determine which mode was selected more intelligently.

LMS-1384
parent 9f104eb6
...@@ -82,9 +82,7 @@ class ChooseModeView(View): ...@@ -82,9 +82,7 @@ class ChooseModeView(View):
upgrade = request.GET.get('upgrade', False) upgrade = request.GET.get('upgrade', False)
requested_mode = self.get_requested_mode(request.POST.get("mode")) requested_mode = self.get_requested_mode(request.POST)
if requested_mode == "verified" and request.POST.get("honor-code"):
requested_mode = "honor"
allowed_modes = CourseMode.modes_for_course_dict(course_id) allowed_modes = CourseMode.modes_for_course_dict(course_id)
if requested_mode not in allowed_modes: if requested_mode not in allowed_modes:
...@@ -125,14 +123,14 @@ class ChooseModeView(View): ...@@ -125,14 +123,14 @@ class ChooseModeView(View):
reverse('verify_student_show_requirements', reverse('verify_student_show_requirements',
kwargs={'course_id': course_id}) + "?upgrade={}".format(upgrade)) kwargs={'course_id': course_id}) + "?upgrade={}".format(upgrade))
def get_requested_mode(self, user_choice): def get_requested_mode(self, request_dict):
""" """
Given the text of `user_choice`, return the Given the request object of `user_choice`, return the
corresponding course mode slug corresponding course mode slug
""" """
choices = { if 'audit_mode' in request_dict:
"Select Audit": "audit", return 'audit'
"Select Certificate": "verified", if 'certificate_mode' and request_dict.get("honor-code"):
"Upgrade Your Registration": "verified" return 'honor'
} if 'certificate_mode' in request_dict:
return choices.get(user_choice) return 'verified'
...@@ -134,9 +134,9 @@ $(document).ready(function() { ...@@ -134,9 +134,9 @@ $(document).ready(function() {
<ul class="list-actions"> <ul class="list-actions">
<li class="action action-select"> <li class="action action-select">
%if upgrade: %if upgrade:
<input type="submit" name="mode" value="Upgrade Your Registration" /> <input type="submit" name="certificate_mode" value="${_('Upgrade Your Registration')}" />
%else: %else:
<input type="submit" name="mode" value="Select Certificate" /> <input type="submit" name="certificate_mode" value="${_('Select Certificate')}" />
%endif %endif
</li> </li>
...@@ -179,7 +179,7 @@ $(document).ready(function() { ...@@ -179,7 +179,7 @@ $(document).ready(function() {
<ul class="list-actions"> <ul class="list-actions">
<li class="action action-select"> <li class="action action-select">
<input type="submit" name="mode" value="Select Audit" /> <input type="submit" name="audit_mode" value="${_('Select Audit')}" />
</li> </li>
</ul> </ul>
</div> </div>
......
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