Commit c5fd2071 by Chris Dodge

custom practice exam error page

parent dca995b3
......@@ -920,7 +920,10 @@ def get_student_view(user_id, course_id, content_id,
elif attempt['status'] == ProctoredExamStudentAttemptStatus.ready_to_start:
student_view_template = 'proctoring/seq_proctored_exam_ready_to_start.html'
elif attempt['status'] == ProctoredExamStudentAttemptStatus.error:
student_view_template = 'proctoring/seq_proctored_exam_error.html'
if attempt['is_sample_attempt']:
student_view_template = 'proctoring/seq_proctored_practice_exam_error.html'
else:
student_view_template = 'proctoring/seq_proctored_exam_error.html'
elif attempt['status'] == ProctoredExamStudentAttemptStatus.timed_out:
student_view_template = 'proctoring/seq_timed_exam_expired.html'
elif attempt['status'] == ProctoredExamStudentAttemptStatus.submitted:
......
{% load i18n %}
<div class="failure sequence proctored-exam" data-exam-id="{{exam_id}}">
<h3>
{% blocktrans %}
Your proctoring proctoring session is in error
{% endblocktrans %}
</h3>
<h4>
{% blocktrans %}
Your Practice Proctoring Session: <b class="failure"> Failed </b>
{% endblocktrans %}
</h4>
<p>
{% blocktrans %}
It appears that your proctoring session has been shut down while you were taking this
practice exam. Your practice exam is considered in error. While this will not affect your grade
or credit eligibility, it is recommended that you retry this practice exam until your
are successful
{% endblocktrans %}
</p>
<hr>
<div class="gated-sequence">
<span><i class="fa fa-lock"></i></span>
<a class="start-timed-exam" data-ajax-url="{{enter_exam_endpoint}}" data-exam-id="{{exam_id}}" data-attempt-proctored=true data-start-immediately=false>
{% trans "Please retry this practice exam again" %}
</a>
</div>
</div>
<script type="text/javascript">
$('.start-timed-exam').click(
function(event) {
var action_url = $(this).data('ajax-url');
var exam_id = $(this).data('exam-id');
var attempt_proctored = $(this).data('attempt-proctored');
var start_immediately = $(this).data('start-immediately');
if (typeof action_url === "undefined" ) {
return false;
}
$.post(
action_url,
{
"exam_id": exam_id,
"attempt_proctored": attempt_proctored,
"start_clock": start_immediately
},
function(data) {
// reload the page, because we've unlocked it
location.reload();
}
);
}
);
</script>
......@@ -105,6 +105,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
self.start_a_practice_exam_msg = 'Would you like to take %s as a practice proctored exam?'
self.practice_exam_submitted_msg = 'You have submitted this practice proctored exam'
self.ready_to_start_msg = 'Your Proctoring Installation and Set Up is Complete'
self.practice_exam_failed_msg = 'Your proctoring proctoring session is in error'
set_runtime_service('credit', MockCreditService())
set_runtime_service('instructor', MockInstructorService())
......@@ -1012,7 +1013,7 @@ class ProctoredExamApiTests(LoggedInTestCase):
Test for get_student_view proctored exam which has exam status error.
"""
ProctoredExamStudentAttempt.objects.create(
exam_attempt = ProctoredExamStudentAttempt.objects.create(
proctored_exam_id=self.proctored_exam_id,
user_id=self.user_id,
external_id=self.external_id,
......@@ -1033,6 +1034,22 @@ class ProctoredExamApiTests(LoggedInTestCase):
)
self.assertIn(self.exam_time_error_msg, rendered_response)
# test the variant if we are a sample attempt
exam_attempt.is_sample_attempt = True
exam_attempt.save()
rendered_response = get_student_view(
user_id=self.user_id,
course_id=self.course_id,
content_id=self.content_id,
context={
'is_proctored': True,
'display_name': self.exam_name,
'default_time_limit_mins': 90
}
)
self.assertIn(self.practice_exam_failed_msg, rendered_response)
def test_get_studentview_unstarted_timed_exam(self): # pylint: disable=invalid-name
"""
Test for get_student_view Timed exam which is not proctored and has not started yet.
......
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