-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Filter out empty answers before submitting the survey
1. The buildSurveyVisitData function now includes an 'if (answers[key])' statement. So the survey data builds only for questions that have received a response. For example, {1: ‘’, 2: ‘yes’, 3: ‘’} becomes { 2: { survey_question_id: 2, answer: ‘yes'}}. Note: This created an issue that when the survey only received responses for question 2, and the rest of the survey answers were undefined. And mui wornings went crazy in a loop. 2. The buildDataFromSurveyAnswers function then was modified to handle the missing data that came back. A numberOfQuestions parameter was added to it. For example, if the survey received only answer 2, 1, 3,.... was constructed as {1: ‘’, 2: ‘yes’, 3: ‘’.....} 3. I needed to get the number of survey quetions, so in SurveyVisitProfile.js, I integrated the useGetSurveyStructureQuery to dynamically retrieve the number of survey questions. I didn't want to hardcoding this value.
- Loading branch information
Showing
2 changed files
with
32 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters