Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle DataError during XForms submission. #1537

Merged
merged 1 commit into from
Jan 23, 2019

Conversation

bmarika
Copy link
Contributor

@bmarika bmarika commented Jan 11, 2019

Fixes #1535 and #949

@bmarika bmarika requested a review from ukanga January 11, 2019 13:58
@@ -403,14 +404,16 @@ def safe_create_instance(username, xml_file, media_files, uuid, request):
error = OpenRosaResponseBadRequest(
_(u"Unable to submit because there are multiple forms with"
u" this formID."))
except DataError as e:
error = OpenRosaResponseBadRequest(
'Data Incompatible with the database provided')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the exceptions, it seems we had a calculate field that returned an Infinity result. I am wondering whether rejecting such submissions is the right way to go about it. Can we be clear in our message of the issue so that an enumerator can know what to check and change on their end? Or should we accept the result as is and replace the Infinity with something that can be stored in a JSON field?
It would be ideal to see if we can actually replicate the issue to determine if the issue is in the data collection tools Enketo or ODK Collect and what could be potentially be solved on that end.

@bmarika bmarika force-pushed the handle-data-error-on-xform-submission branch 7 times, most recently from 71081d0 to 8fa4643 Compare January 23, 2019 06:33
@@ -353,7 +353,8 @@ def create_instance(username,
instance.save()

instance = DuplicateInstance()

except DataError as error:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This except block here is irrelevant, we are not raising a specific exception. I will recommend removing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -403,14 +404,17 @@ def safe_create_instance(username, xml_file, media_files, uuid, request):
error = OpenRosaResponseBadRequest(
_(u"Unable to submit because there are multiple forms with"
u" this formID."))
except DataError as e:
error = OpenRosaResponseBadRequest(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this have to be 3 lines could, OpenRosaResponseBadRequest(str(e)) not fit within the 79/80 line limit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@bmarika bmarika force-pushed the handle-data-error-on-xform-submission branch from 8fa4643 to 38594ec Compare January 23, 2019 07:21
@ukanga ukanga merged commit e1d05a2 into master Jan 23, 2019
@ukanga ukanga deleted the handle-data-error-on-xform-submission branch January 23, 2019 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants