Skip to content

Commit

Permalink
fix: fix PWA issues (#980)
Browse files Browse the repository at this point in the history
this commit fixes issues reported from users.
the issues are due to upgrading marshmallow
  • Loading branch information
dodumosu authored Aug 28, 2024
1 parent 0bed45d commit 3898580
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apollo/participants/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def get_forms():

forms, serials = _get_form_data(participant)

form_data = FormSchema(many=True).dump(forms).data
form_data = FormSchema(many=True).dump(forms)

response_body = {
'data': {
Expand Down
8 changes: 5 additions & 3 deletions apollo/submissions/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from flask_babelex import gettext
from flask_jwt_extended import get_jwt_identity, jwt_required
from flask_security.decorators import login_required
from marshmallow import ValidationError
from slugify import slugify
from sqlalchemy.exc import ProgrammingError
from sqlalchemy.orm.exc import NoResultFound
Expand Down Expand Up @@ -227,9 +228,10 @@ def submission():

# validate payload
schema_class = form.create_schema()
data, errors = schema_class().load(payload)
if errors:
error_fields = sorted(errors.keys())
try:
data = schema_class().load(payload)
except ValidationError as ex:
error_fields = sorted(ex.messages.keys())
response_body = {
'message': gettext('Invalid value(s) for: %(fields)s',
fields=','.join(error_fields)),
Expand Down

0 comments on commit 3898580

Please sign in to comment.