Parcourir la source

:construction: Small optimization in surveycompleteview logic

juan-filtering-match-pool
tomit4 il y a 2 ans
Parent
révision
07b9d52e6b

+ 1
- 1
frontend/src/views/OnboardingView.vue Voir le fichier

@@ -55,6 +55,7 @@ export default {
55 55
         invalidResponse: false,
56 56
     }),
57 57
     async created() {
58
+        // TODO: Troubleshoot bug where memberships are not returned from backend with 500 err
58 59
         // TODO: Troubleshoot bug where not all responses are returned at SurveyCompleteView
59 60
         console.log('currentProfile :=>', currentProfile)
60 61
         this.survey = await surveyFactory.createSurvey()
@@ -116,7 +117,6 @@ export default {
116 117
             })
117 118
         },
118 119
         async updateAnswers(payload) {
119
-            console.log('this.survey.steps :=>', this.survey.steps)
120 120
             if (payload) {
121 121
                 const k = payload.question.survey_stage
122 122
                 this.answered[k] = payload.input

+ 5
- 8
frontend/src/views/SurveyCompleteView.vue Voir le fichier

@@ -37,8 +37,7 @@ export default {
37 37
     created() {
38 38
         // TODO: Troubleshoot bug where not all responses are returned
39 39
         console.log('currentProfile :=>', currentProfile)
40
-        this.aspectQuestions = this.parseSurvey(this.surveySteps, false)
41
-        this.surveyStages = this.parseSurvey(this.surveySteps, true)
40
+        this.parseSurvey(this.surveySteps)
42 41
         this.aspectResponses = this.grabAspectResponses(
43 42
             currentProfile._profile.responses,
44 43
             this.aspectQuestions,
@@ -50,19 +49,17 @@ export default {
50 49
         )
51 50
     },
52 51
     methods: {
53
-        parseSurvey(surveySteps, isStage) {
54
-            const parsedAspects = {}
55
-            const parsedStages = {}
52
+        parseSurvey(surveySteps) {
56 53
             surveySteps.forEach(step => {
57 54
                 const isAspect = step.category === 'aspect'
58 55
                 if (isAspect) {
59
-                    parsedAspects[`${step.response_key_id}`] =
56
+                    this.aspectQuestions[`${step.response_key_id}`] =
60 57
                         step.response_key_prompt
61 58
                 } else {
62
-                    parsedStages[`${step.response_key_id}`] = step.survey_stage
59
+                    this.surveyStages[`${step.response_key_id}`] =
60
+                        step.survey_stage
63 61
                 }
64 62
             })
65
-            return isStage ? parsedStages : parsedAspects
66 63
         },
67 64
         grabResponsesFromProfile(aspectQuestions) {
68 65
             const aspectQuestionsKeys = Object.keys(aspectQuestions).map(Number)

Chargement…
Annuler
Enregistrer