fix(submitted_landings): support submitted landings without answers #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
This fixes a problem in which this tap would fail when at least 1 submitted landing had no answers. This was resulting in a problem in which the process would exit and a bunch of data would not be extracted.
This problem happens for forms in which every field is not required, thus the user is able to submit the response without answering any questions. The following error then would show up when running this tap if at least a single user response fell in such scenario:
This is bad, as even if the admin updates the form now making the questions required, the existing responses will still fail to be processed by this tap, as old responses without answers will still exist.
I fixed this by simply checking if the stream's child key is blank on the record, then it won't try to process the children data. e.g: when running the
submitted_landing
stream, if the record'sanswers
attribute is blank, then it will register asubmitted_landing
, but noanswers
. As expected 😄Also, this fixes both reported issues: #22 and #24
Manual QA steps
1 - Create a form, with 1 or more questions, in which none of them have the "required" validation. e.g:

2 - Open the form and submit it without answering the questions
3 - Run this tap for that form_id
4 - 💥!
CRITICAL 'NoneType' object is not iterable
Risks
Rollback steps