Commit d00ee3cf by Afzal Wali Committed by Douglas Hall

Increased in-exam polling interval from 5 seconds to 30 seconds.

Added query parameter to identify the source of the call to the  AJAX endpoint edx_proctoring.views:StudentProctoredExamAttempt.get:

 ?sourceid=in_exam
 ?sourceid=instructions
 ?sourceid=app_shutdown
parent da76a638
......@@ -136,15 +136,14 @@ var edx = edx || {};
updateRemainingTime: function (self) {
self.timerTick ++;
self.secondsLeft --;
if (self.timerTick % 5 === 0){
var url = self.model.url + '/' + self.model.get('attempt_id');
if (self.timerTick % 30 === 0){
var url = self.model.url + '/' + self.model.get('attempt_id') + '?sourceid=in_exam';
$.ajax(url).success(function(data) {
if (data.status === 'error') {
// The proctoring session is in error state
// refresh the page to
// refresh the page to bring up the new Proctoring state from the backend.
clearInterval(self.timerId); // stop the timer once the time finishes.
$(window).unbind('beforeunload', self.unloadMessage);
// refresh the page when the timer expired
location.reload();
}
else {
......
......@@ -62,7 +62,7 @@ describe('ProctoredExamView', function () {
expect(reloadPage).toHaveBeenCalled();
});
it("resets the remainig exam time after the ajax response", function(){
this.server.respondWith("GET", "/api/edx_proctoring/v1/proctored_exam/attempt/" + this.proctored_exam_view.model.get('attempt_id'),
this.server.respondWith("GET", "/api/edx_proctoring/v1/proctored_exam/attempt/" + this.proctored_exam_view.model.get('attempt_id') + '?sourceid=in_exam',
[
200,
{"Content-Type": "application/json"},
......@@ -71,7 +71,7 @@ describe('ProctoredExamView', function () {
})
]
);
this.proctored_exam_view.timerTick = 4; // to make the ajax call.
this.proctored_exam_view.timerTick = 29; // to make the ajax call.
var reloadPage = spyOn(this.proctored_exam_view, 'reloadPage');
this.proctored_exam_view.updateRemainingTime(this.proctored_exam_view);
this.server.respond();
......
......@@ -95,7 +95,7 @@
});
function poll_exam_started() {
var url = $('.instructions').data('exam-started-poll-url');
var url = $('.instructions').data('exam-started-poll-url') + '?sourceid=instructions';
$.ajax(url).success(function(data){
if (data.status === 'ready_to_start') {
if (_waiting_for_proctored_interval != null) {
......
......@@ -30,7 +30,7 @@
});
function poll_exam_started() {
var url = '{{ exam_started_poll_url }}';
var url = '{{ exam_started_poll_url }}' + '?sourceid=app_shutdown';
$.ajax(url).success(function(data){
if (data.status === 'submitted') {
// Do we believe the client proctoring app has shut down
......
......@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):
setup(
name='edx-proctoring',
version='0.12.16',
version='0.12.17',
description='Proctoring subsystem for Open edX',
long_description=open('README.md').read(),
author='edX',
......
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