Skip to content

Commit

Permalink
Merge pull request #930 from edx/mohtamba/fix-error-field-association
Browse files Browse the repository at this point in the history
Adjusted error location
  • Loading branch information
mohtamba authored Aug 9, 2021
2 parents 6e927c4 + 200f2b2 commit c9208d2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
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__ = '3.23.1'
__version__ = '3.23.2'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
Expand Down
3 changes: 3 additions & 0 deletions edx_proctoring/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
4 changes: 2 additions & 2 deletions edx_proctoring/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")}
)


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": "3.23.1",
"version": "3.23.2",
"main": "edx_proctoring/static/index.js",
"scripts": {
"test": "gulp test"
Expand Down

0 comments on commit c9208d2

Please sign in to comment.