Skip to content

Commit

Permalink
feat: pass external attempt id to provider js (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacharis278 committed Oct 20, 2022
1 parent dbc242e commit 0588aad
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Change Log
Unreleased
~~~~~~~~~~

[4.12.2] - 2022-10-19
~~~~~~~~~~~~~~~~~~~~~
* Return external id when requesting exam attempt
* Add new parameter to JS worker to pass attempt external id

[4.12.1] - 2022-09-15
~~~~~~~~~~~~~~~~~~~~~
* Revert Phantom JS and eslint migration made in version 4.11.0
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"""

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '4.12.1'
__version__ = '4.12.2'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
1 change: 1 addition & 0 deletions edx_proctoring/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ def get_exam_attempt_data(exam_id, attempt_id, is_learning_mfe=False):
'critically_low_threshold_sec': critically_low_threshold,
'course_id': exam['course_id'],
'attempt_id': attempt['id'],
'external_id': attempt['external_id'],
'accessibility_time_string': _('you have {remaining_time} remaining').format(
remaining_time=humanized_time(int(round(time_remaining_seconds / 60.0, 0)))
),
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const handlerWrapper = (Handler) => {
}
case 'startExamAttempt': {
if (handler.onStartExamAttempt) {
handler.onStartExamAttempt(message.data.timeout)
handler.onStartExamAttempt(message.data.timeout, message.data.attemptExternalId)
.then(() => self.postMessage({ type: 'examAttemptStarted' }))
.catch(error => self.postMessage({ type: 'examAttemptStartFailed', error }));
}
Expand Down
8 changes: 8 additions & 0 deletions edx_proctoring/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3550,6 +3550,14 @@ def test_get_exam_attempt_data(self, is_proctored_exam, is_learning_mfe):
assert 'exam_url_path' in attempt_data
assert attempt_data['exam_url_path'] == expected_exam_url

def test_exam_attempt_external_id(self):
""" Test external id is included in attempt data """
attempt = self._create_started_exam_attempt(is_proctored=True)
external_id = self.external_id

attempt_data = get_exam_attempt_data(self.proctored_exam_id, attempt.id, is_learning_mfe=True)
assert attempt_data['external_id'] == external_id

@ddt.data(
(True, True, 'an onboarding exam'),
(True, False, 'a proctored exam'),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edx/edx-proctoring",
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.",
"version": "4.12.1",
"version": "4.12.2",
"main": "edx_proctoring/static/index.js",
"scripts": {
"test": "gulp test"
Expand Down

0 comments on commit 0588aad

Please sign in to comment.