Commit aade2803 by Chris Dodge

poll on the productoring instruction pages so that it will automatically detect…

poll on the productoring instruction pages so that it will automatically detect when the proctoring has been launched
parent 29bc49df
...@@ -442,6 +442,10 @@ def get_student_view(user_id, course_id, content_id, context): ...@@ -442,6 +442,10 @@ def get_student_view(user_id, course_id, content_id, context):
'total_time': total_time, 'total_time': total_time,
'exam_id': exam_id, 'exam_id': exam_id,
'enter_exam_endpoint': reverse('edx_proctoring.proctored_exam.attempt.collection'), 'enter_exam_endpoint': reverse('edx_proctoring.proctored_exam.attempt.collection'),
'exam_started_poll_url': reverse(
'edx_proctoring.proctored_exam.attempt',
args=[attempt['id']]
) if attempt else ''
}) })
return template.render(django_context) return template.render(django_context)
......
{% load i18n %} {% load i18n %}
<div class="sequence proctored-exam instructions" data-exam-id="{{exam_id}}"> <div class="sequence proctored-exam instructions" data-exam-id="{{exam_id}}" data-exam-started-poll-url="{{exam_started_poll_url}}">
<h3> <h3>
{% blocktrans %} {% blocktrans %}
Awaiting Proctoring Installation & Set Up Awaiting Proctoring Installation & Set Up
...@@ -41,34 +41,21 @@ ...@@ -41,34 +41,21 @@
{% include 'proctoring/seq_proctored_exam_footer.html' %} {% include 'proctoring/seq_proctored_exam_footer.html' %}
<script type="text/javascript"> <script type="text/javascript">
$('.start-timed-exam').click(
$(document).ready( $(document).ready(function(){
setTimeout( setInterval(
function(){ poll_exam_started,
$.ajax('api/edx_proctoring/v1/') 5000
}, 5000
);
); );
function(event) { });
var action_url = $(this).data('ajax-url');
var exam_id = $(this).data('exam-id'); function poll_exam_started() {
var attempt_proctored = $(this).data('attempt-proctored'); var url = $('.instructions').data('exam-started-poll-url')
var start_immediately = $(this).data('start-immediately'); $.ajax(url).success(function(data){
if (typeof action_url === "undefined" ) { if (data.started_at !== null) {
return false; location.reload()
} }
$.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> </script>
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