Skip to content

Commit

Permalink
Increased in-exam polling interval from 5 seconds to 30 seconds.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Afzal Wali authored and Douglas Hall committed May 4, 2016
1 parent da76a63 commit d00ee3c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions edx_proctoring/static/proctoring/spec/proctored_exam_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/templates/proctored_exam/instructions.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ <h3>
});

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h3>
});

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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit d00ee3c

Please sign in to comment.