diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 895c1cc4eaf..c2c80aa33e6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,16 @@ Change Log Unreleased ~~~~~~~~~~ + +[3.13.1] - 2021-06-08 +~~~~~~~~~~~~~~~~~~~~~ +* If an attempt transitions from `ready_to_submit` back to `started`, the proctoring provider + backend function `start_exam_attempt` will not be called. + +[3.13.0] - 2021-06-07 +~~~~~~~~~~~~~~~~~~~~~ +* If the Django setting `PROCTORED_EXAM_VIEWABLE_PAST_DUE` is false, exam content will not be viewable past + an exam's due date, even if a learner has acknowledged their status. * Extend exam attempt API to return exam type and to check if user has satisfied prerequisites before taking proctored exam. * Extend proctoring settings API to return additional data about proctoring @@ -20,11 +30,6 @@ Unreleased * Add API endpoint which provides exam review policy for specific exam. Usage case is to provide required data for the learning app MFE. -[3.13.0] - 2021-06-07 -~~~~~~~~~~~~~~~~~~~~~ -* If the Django setting `PROCTORED_EXAM_VIEWABLE_PAST_DUE` is false, exam content will not be viewable past - an exam's due date, even if a learner has acknowledged their status. - [3.12.0] - 2021-06-04 ~~~~~~~~~~~~~~~~~~~~~ * If the `is_integrity_signature_enabled` waffle flag is turned on, do not render the ID verification diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index c65f7cfe7e3..61de5ff5157 100644 --- a/edx_proctoring/__init__.py +++ b/edx_proctoring/__init__.py @@ -3,6 +3,6 @@ """ # Be sure to update the version number in edx_proctoring/package.json -__version__ = '3.13.0' +__version__ = '3.13.1' default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name diff --git a/edx_proctoring/api.py b/edx_proctoring/api.py index 405b97dc500..26045b185be 100644 --- a/edx_proctoring/api.py +++ b/edx_proctoring/api.py @@ -1404,7 +1404,11 @@ def update_attempt_status(attempt_id, to_status, # only proctored/practice exams have a backend # timed exams have no backend backend_method = None - if to_status == ProctoredExamStudentAttemptStatus.started: + + # add_start_time will only have a value of true if this is the first time an + # attempt is transitioning to started. We only want to notify the backend + # for the first time an attempt is transitioned to a started status (MST-862). + if to_status == ProctoredExamStudentAttemptStatus.started and add_start_time: backend_method = backend.start_exam_attempt elif to_status == ProctoredExamStudentAttemptStatus.submitted: backend_method = backend.stop_exam_attempt diff --git a/edx_proctoring/tests/test_api.py b/edx_proctoring/tests/test_api.py index b4357b382e4..5f7f12c3369 100644 --- a/edx_proctoring/tests/test_api.py +++ b/edx_proctoring/tests/test_api.py @@ -63,6 +63,7 @@ update_exam_attempt, update_review_policy ) +from edx_proctoring.backends.tests.test_backend import TestBackendProvider from edx_proctoring.constants import DEFAULT_CONTACT_EMAIL from edx_proctoring.exceptions import ( AllowanceValueNotAllowedException, @@ -1635,6 +1636,33 @@ def test_update_attempt_without_credit_state(self): self.assertEqual(new_attempt, exam_attempt.id) + @patch.object(TestBackendProvider, 'start_exam_attempt') + def test_update_attempt_multiple_starts(self, mock_backend_start): + """ + Test that updating an attempt status to `started` more than once + will only call the backend's start_exam_attempt once + """ + exam_attempt = self._create_exam_attempt(self.proctored_exam_id) + update_attempt_status( + exam_attempt.id, + ProctoredExamStudentAttemptStatus.started + ) + mock_backend_start.assert_called_once() + + # move status to ready to submit + update_attempt_status( + exam_attempt.id, + ProctoredExamStudentAttemptStatus.ready_to_submit + ) + # move status to started + update_attempt_status( + exam_attempt.id, + ProctoredExamStudentAttemptStatus.started + ) + + # make sure that method was not called again + mock_backend_start.assert_called_once() + @ddt.data( ( ProctoredExamStudentAttemptStatus.eligible, { diff --git a/package.json b/package.json index c7976bdf215..5836df14196 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@edx/edx-proctoring", "//": "Be sure to update the version number in edx_proctoring/__init__.py", "//": "Note that the version format is slightly different than that of the Python version when using prereleases.", - "version": "3.13.0", + "version": "3.13.1", "main": "edx_proctoring/static/index.js", "scripts": { "test": "gulp test"