Przeglądaj źródła

:construction: Small optimization in surveycompleteview logic

juan-filtering-match-pool
tomit4 2 lat temu
rodzic
commit
07b9d52e6b

+ 1
- 1
frontend/src/views/OnboardingView.vue Wyświetl plik

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

+ 5
- 8
frontend/src/views/SurveyCompleteView.vue Wyświetl plik

37
     created() {
37
     created() {
38
         // TODO: Troubleshoot bug where not all responses are returned
38
         // TODO: Troubleshoot bug where not all responses are returned
39
         console.log('currentProfile :=>', currentProfile)
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
         this.aspectResponses = this.grabAspectResponses(
41
         this.aspectResponses = this.grabAspectResponses(
43
             currentProfile._profile.responses,
42
             currentProfile._profile.responses,
44
             this.aspectQuestions,
43
             this.aspectQuestions,
50
         )
49
         )
51
     },
50
     },
52
     methods: {
51
     methods: {
53
-        parseSurvey(surveySteps, isStage) {
54
-            const parsedAspects = {}
55
-            const parsedStages = {}
52
+        parseSurvey(surveySteps) {
56
             surveySteps.forEach(step => {
53
             surveySteps.forEach(step => {
57
                 const isAspect = step.category === 'aspect'
54
                 const isAspect = step.category === 'aspect'
58
                 if (isAspect) {
55
                 if (isAspect) {
59
-                    parsedAspects[`${step.response_key_id}`] =
56
+                    this.aspectQuestions[`${step.response_key_id}`] =
60
                         step.response_key_prompt
57
                         step.response_key_prompt
61
                 } else {
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
         grabResponsesFromProfile(aspectQuestions) {
64
         grabResponsesFromProfile(aspectQuestions) {
68
             const aspectQuestionsKeys = Object.keys(aspectQuestions).map(Number)
65
             const aspectQuestionsKeys = Object.keys(aspectQuestions).map(Number)

Ładowanie…
Anuluj
Zapisz