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):
'total_time': total_time,
'exam_id': exam_id,
'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)
......
{% 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>
{% blocktrans %}
Awaiting Proctoring Installation & Set Up
......@@ -41,34 +41,21 @@
{% include 'proctoring/seq_proctored_exam_footer.html' %}
<script type="text/javascript">
$('.start-timed-exam').click(
$(document).ready(
setTimeout(
function(){
$.ajax('api/edx_proctoring/v1/')
}, 5000
);
$(document).ready(function(){
setInterval(
poll_exam_started,
5000
);
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;
});
function poll_exam_started() {
var url = $('.instructions').data('exam-started-poll-url')
$.ajax(url).success(function(data){
if (data.started_at !== null) {
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>
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