diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 82210c26a34..3e8fd22fe11 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,10 @@ Change Log Unreleased ~~~~~~~~~~ +[3.23.2] - 2021-08-06 +~~~~~~~~~~~~~~~~~~~~~ +* Change errors on the bulk allowance modal so they appear on their associated field. + [3.23.1] - 2021-08-06 ~~~~~~~~~~~~~~~~~~~~~ * Fixes bug that occurs when a proctoring vendor returns onboarding information that includes user IDs that represent diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index 0ac84dd5cfb..b5c9e703502 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.23.1' +__version__ = '3.23.2' default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name diff --git a/edx_proctoring/static/proctoring/js/views/proctored_exam_add_bulk_allowance_view.js b/edx_proctoring/static/proctoring/js/views/proctored_exam_add_bulk_allowance_view.js index 110bb7a8fa6..2074cf2ca51 100644 --- a/edx_proctoring/static/proctoring/js/views/proctored_exam_add_bulk_allowance_view.js +++ b/edx_proctoring/static/proctoring/js/views/proctored_exam_add_bulk_allowance_view.js @@ -201,7 +201,7 @@ edx = edx || {}; }, error: function(unused, response) { var data = $.parseJSON(response.responseText); - $errorResponse.html(gettext(data.detail)); + self.showError(self, data.field, data.detail); } }); } diff --git a/edx_proctoring/static/proctoring/js/views/proctored_exam_edit_allowance_view.js b/edx_proctoring/static/proctoring/js/views/proctored_exam_edit_allowance_view.js index ffa758e5f89..46850215f6f 100644 --- a/edx_proctoring/static/proctoring/js/views/proctored_exam_edit_allowance_view.js +++ b/edx_proctoring/static/proctoring/js/views/proctored_exam_edit_allowance_view.js @@ -142,7 +142,7 @@ edx = edx || {}; }, error: function(unused, response) { var data = $.parseJSON(response.responseText); - $errorResponse.html(gettext(data.detail)); + self.showError(self, data.field, data.detail); } }); } diff --git a/edx_proctoring/tests/test_views.py b/edx_proctoring/tests/test_views.py index 16fc6e119dd..75f1c628886 100644 --- a/edx_proctoring/tests/test_views.py +++ b/edx_proctoring/tests/test_views.py @@ -5167,6 +5167,9 @@ def test_add_bulk_allowance_invalid_allowance_value(self, allowance_type, value) content_type='application/json' ) self.assertEqual(response.status_code, 400) + response_data = json.loads(response.content.decode('utf-8')) + self.assertEqual(response_data['detail'], 'Enter a valid positive value number') + self.assertEqual(response_data['field'], 'allowance_value') def test_add_bulk_allowance_all_invalid_data(self): # pylint: disable=invalid-name """ diff --git a/edx_proctoring/views.py b/edx_proctoring/views.py index 03d335aeb0f..1089e41ef52 100644 --- a/edx_proctoring/views.py +++ b/edx_proctoring/views.py @@ -1580,7 +1580,7 @@ def put(self, request): if successes == 0: return Response( status=status.HTTP_400_BAD_REQUEST, - data={"detail": _("Enter a valid username or email")} + data={"detail": _("Enter a valid username or email"), "field": _("user_info")} ) if failures > 0: return Response( @@ -1593,7 +1593,7 @@ def put(self, request): except AllowanceValueNotAllowedException: return Response( status=status.HTTP_400_BAD_REQUEST, - data={"detail": _("Enter a valid positive value number")} + data={"detail": _("Enter a valid positive value number"), "field": _("allowance_value")} ) diff --git a/package.json b/package.json index cd5ff39ead2..541ec4ef25f 100644 --- a/package.json +++ b/package.json @@ -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": "3.23.1", + "version": "3.23.2", "main": "edx_proctoring/static/index.js", "scripts": { "test": "gulp test"