Skip to content

Commit

Permalink
Use instructions from the subclass instead of from the API request
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave St.Germain committed Dec 6, 2018
1 parent 8d9aa23 commit c73d4b9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

from __future__ import absolute_import

__version__ = '1.5.0b3'
__version__ = '1.5.0'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
9 changes: 9 additions & 0 deletions edx_proctoring/backends/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ def instructor_url(self):
"Returns the instructor dashboard url"
return self.base_url + u'/api/v1/instructor/{client_id}/?jwt={jwt}'

@property
def proctoring_instructions(self):
"Returns the (optional) proctoring instructions"
return []

def __init__(self, client_id=None, client_secret=None, **kwargs):
"""
Initialize REST backend.
Expand Down Expand Up @@ -139,6 +144,10 @@ def get_attempt(self, attempt):
attempt['proctored_exam']['external_id'],
attempt['external_id'],
method='GET')
# If the class has instructions defined, use them.
# Otherwise, the instructions should be returned by this
# API request. Subclasses should wrap each instruction with gettext
response['instructions'] = self.proctoring_instructions or response.get('instructions', [])
return response

def register_exam_attempt(self, exam, context):
Expand Down
3 changes: 2 additions & 1 deletion edx_proctoring/backends/tests/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def test_get_attempt(self):
'id': 1,
'external_id': 'abcd',
'proctored_exam': self.backend_exam,
'user': 1
'user': 1,
'instructions': [],
}
responses.add(
responses.GET,
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 @@ -195,7 +195,7 @@ <h2 id="acessible-error-title">{% trans "Cannot Start Proctored Exam" %}</h2>
},
success: function (data) {
newWindow.location = "{{software_download_url|safe}}";
setTimeout(poll_until_ready, 15000);
// setTimeout(poll_until_ready, 15000);
}
}).fail(function(){
newWindow.close();
Expand Down

0 comments on commit c73d4b9

Please sign in to comment.