Parcourir la source

:memo: Commented on adding new survey questions in prep for refactor

tags/0.0.3^2
tomit4 il y a 3 ans
Parent
révision
8909c1672d

+ 30
- 21
backend/db/data-generator/mock.js Voir le fichier

430
         {
430
         {
431
             response_key_id: 1,
431
             response_key_id: 1,
432
             response_key_category: 'visionary_vs_implementer',
432
             response_key_category: 'visionary_vs_implementer',
433
-            response_key_prompt:
434
-                'Do you prefer to work with those who are driven by their Visionary insights, or those who are driven more by their Implementation?',
433
+            response_key_prompt: 'Do you prefer to work with those who are driven by their Visionary insights, or those who are driven more by their Implementation?',
435
             response_key_description: 'first round draft scoring question',
434
             response_key_description: 'first round draft scoring question',
436
         },
435
         },
437
         {
436
         {
438
             response_key_id: 2,
437
             response_key_id: 2,
439
             response_key_category: 'creative_vs_methodical',
438
             response_key_category: 'creative_vs_methodical',
440
-            response_key_prompt:
441
-                'Have you found more success working with employees that are more Creative or those that are more Methodical?',
439
+            response_key_prompt: 'Have you found more success working with employees that are more Creative or those that are more Methodical?',
442
             response_key_description: 'first round draft scoring question',
440
             response_key_description: 'first round draft scoring question',
443
         },
441
         },
444
         {
442
         {
445
             response_key_id: 3,
443
             response_key_id: 3,
446
             response_key_category: 'dynamic_vs_ordered',
444
             response_key_category: 'dynamic_vs_ordered',
447
-            response_key_prompt:
448
-                'Which do you find to be the ideal working environment, one that is more Collaborative or one that is more Independent?',
445
+            response_key_prompt: 'Which do you find to be the ideal working environment, one that is more Collaborative or one that is more Independent?',
449
             response_key_description: 'first round draft scoring question',
446
             response_key_description: 'first round draft scoring question',
450
         },
447
         },
451
         {
448
         {
452
             response_key_id: 4,
449
             response_key_id: 4,
453
             response_key_category: 'precise_vs_resourceful',
450
             response_key_category: 'precise_vs_resourceful',
454
-            response_key_prompt:
455
-                'Is the success of your team more likely if it includes individuals who are more Innovative, or those that are more Conventional when fulfilling their job duties?',
451
+            response_key_prompt: 'Is the success of your team more likely if it includes individuals who are more Innovative, or those that are more Conventional when fulfilling their job duties?',
456
             response_key_description: 'first round draft scoring question',
452
             response_key_description: 'first round draft scoring question',
457
         },
453
         },
458
         {
454
         {
459
             response_key_id: 5,
455
             response_key_id: 5,
460
             response_key_category: 'big_Picture_vs_focused',
456
             response_key_category: 'big_Picture_vs_focused',
461
-            response_key_prompt:
462
-                'When fulfilling the role of the hiring leader, do you find yourself focusing more on the Big Picture or The Task At Hand?',
457
+            response_key_prompt: 'When fulfilling the role of the hiring leader, do you find yourself focusing more on the Big Picture or The Task At Hand?',
463
             response_key_description: 'first round draft scoring question',
458
             response_key_description: 'first round draft scoring question',
464
         },
459
         },
465
         {
460
         {
466
             response_key_id: 6,
461
             response_key_id: 6,
467
             response_key_category: 'guided_vs_self-managed',
462
             response_key_category: 'guided_vs_self-managed',
468
-            response_key_prompt:
469
-                'Do you prefer to Guide your employees towards achieving the team goals, or do you prefer your employees to be Self-Managed?',
463
+            response_key_prompt: 'Do you prefer to Guide your employees towards achieving the team goals, or do you prefer your employees to be Self-Managed?',
470
             response_key_description: 'first round draft scoring question',
464
             response_key_description: 'first round draft scoring question',
471
         },
465
         },
466
+        // TO ADD ASPECT: when creating new survey aspect step, add here, re-order response_key_id and run npm run reseed
472
         {
467
         {
473
             response_key_id: 7,
468
             response_key_id: 7,
469
+            response_key_category: 'love_vs_hate',
470
+            response_key_prompt: 'Do you prefer to be loved our hated?',
471
+            response_key_description: 'total test question, to be deleted',
472
+        },
473
+        {
474
+            response_key_id: 8,
474
             response_key_category: 'profile',
475
             response_key_category: 'profile',
475
             response_key_prompt: 'zipcode',
476
             response_key_prompt: 'zipcode',
476
             response_key_description: 'required for distance calculations',
477
             response_key_description: 'required for distance calculations',
477
         },
478
         },
478
         {
479
         {
479
-            response_key_id: 8,
480
+            response_key_id: 9,
480
             response_key_category: 'profile',
481
             response_key_category: 'profile',
481
             response_key_prompt: 'image',
482
             response_key_prompt: 'image',
482
             response_key_description: 'required for profile pictures',
483
             response_key_description: 'required for profile pictures',
483
         },
484
         },
484
         {
485
         {
485
-            response_key_id: 9,
486
+            response_key_id: 10,
486
             response_key_category: 'profile',
487
             response_key_category: 'profile',
487
             response_key_prompt: 'language',
488
             response_key_prompt: 'language',
488
             response_key_description:
489
             response_key_description:
489
                 'programming and spoken language preference',
490
                 'programming and spoken language preference',
490
         },
491
         },
491
         {
492
         {
492
-            response_key_id: 10,
493
+            response_key_id: 11,
493
             response_key_category: 'profile',
494
             response_key_category: 'profile',
494
             response_key_prompt: 'duration',
495
             response_key_prompt: 'duration',
495
             response_key_description:
496
             response_key_description:
496
                 'duration preference for hours able to dedicate to work',
497
                 'duration preference for hours able to dedicate to work',
497
         },
498
         },
498
         {
499
         {
499
-            response_key_id: 11,
500
+            response_key_id: 12,
500
             response_key_category: 'profile',
501
             response_key_category: 'profile',
501
             response_key_prompt: 'presence',
502
             response_key_prompt: 'presence',
502
             response_key_description:
503
             response_key_description:
503
                 'location preference for where work happens',
504
                 'location preference for where work happens',
504
         },
505
         },
505
         {
506
         {
506
-            response_key_id: 12,
507
+            response_key_id: 13,
507
             response_key_category: 'profile',
508
             response_key_category: 'profile',
508
             response_key_prompt: 'blurb',
509
             response_key_prompt: 'blurb',
509
             response_key_description: 'required for profile description',
510
             response_key_description: 'required for profile description',
510
         },
511
         },
511
         {
512
         {
512
-            response_key_id: 13,
513
+            response_key_id: 14,
513
             response_key_category: 'profile',
514
             response_key_category: 'profile',
514
             response_key_prompt: 'urgency',
515
             response_key_prompt: 'urgency',
515
             response_key_description: 'urgency for when work is required',
516
             response_key_description: 'urgency for when work is required',
516
         },
517
         },
517
         {
518
         {
518
-            response_key_id: 14,
519
+            response_key_id: 15,
519
             response_key_category: 'profile',
520
             response_key_category: 'profile',
520
             response_key_prompt: 'role',
521
             response_key_prompt: 'role',
521
             response_key_description: 'current and desired role',
522
             response_key_description: 'current and desired role',
522
         },
523
         },
523
         {
524
         {
524
-            response_key_id: 15,
525
+            response_key_id: 16,
525
             response_key_category: 'profile',
526
             response_key_category: 'profile',
526
             response_key_prompt: 'pronouns',
527
             response_key_prompt: 'pronouns',
527
             response_key_description: 'required for profile pronouns',
528
             response_key_description: 'required for profile pronouns',
528
         },
529
         },
529
         {
530
         {
530
-            response_key_id: 16,
531
+            response_key_id: 17,
531
             response_key_category: 'profile',
532
             response_key_category: 'profile',
532
             response_key_prompt: 'distance',
533
             response_key_prompt: 'distance',
533
             response_key_description:
534
             response_key_description:
534
                 'preference for commuting distance cutoff',
535
                 'preference for commuting distance cutoff',
535
         },
536
         },
537
+        // TO ADD: when creating new survey step, add here and run npm run reseed
538
+        {
539
+            response_key_id: 18,
540
+            response_key_category: 'profile',
541
+            response_key_prompt: 'test',
542
+            response_key_description:
543
+                'this is just for testing stuff...',
544
+        },
536
     ],
545
     ],
537
     responses: [],
546
     responses: [],
538
     memberships: [
547
     memberships: [

+ 4
- 2
frontend/src/components/onboarding/Aspects.vue Voir le fichier

5
         :question='question' 
5
         :question='question' 
6
         @updated='updateRadio'
6
         @updated='updateRadio'
7
         @updateIsAnswered='updateIsAnswered'
7
         @updateIsAnswered='updateIsAnswered'
8
-        v-if='question.isBeingAnswered' @update-all='updateAll'
8
+        @update-all='updateAll'
9
+        v-if='question.isBeingAnswered' 
9
     )
10
     )
10
 </template>
11
 </template>
11
 
12
 
12
 <script>
13
 <script>
13
 import QuestionResponse from './QuestionResponse.vue'
14
 import QuestionResponse from './QuestionResponse.vue'
14
-const answered = [null, null, null, null, null, null]
15
+// TO ADD ASPECT: when creating new survey aspect step, increment additional null slots here
16
+const answered = [null, null, null, null, null, null, null]
15
 
17
 
16
 export default {
18
 export default {
17
     name: 'Aspects',
19
     name: 'Aspects',

+ 2
- 1
frontend/src/components/onboarding/QuestionResponse.vue Voir le fichier

4
     section.radio-buttons.w-flex.row.justify-space-between
4
     section.radio-buttons.w-flex.row.justify-space-between
5
         p(v-for="label in question.labels") {{label}}
5
         p(v-for="label in question.labels") {{label}}
6
     w-radios.w-flex.row.justify-space-between(@update:model-value="onUpdate" :items="radioItems" color="red")
6
     w-radios.w-flex.row.justify-space-between(@update:model-value="onUpdate" :items="radioItems" color="red")
7
-    w-button.ma1.grow(v-if='question.id !== 6' @click="updateAnswers") NEXT
7
+    // TO ADD ASPECT: when creating new survey aspect step, increment increment !== statement here
8
+    w-button.ma1.grow(v-if='question.id !== 7' @click="updateAnswers") NEXT
8
     w-button.ma1.grow(v-else @click="updateAll") SUBMIT ANSWERS
9
     w-button.ma1.grow(v-else @click="updateAll") SUBMIT ANSWERS
9
     p(v-if='noChoiceMade') Tough choices, we know! Just answer to the best of your ability. The team over at Siimee values the answers you provide us so that we can show you results catered to your specific needs.
10
     p(v-if='noChoiceMade') Tough choices, we know! Just answer to the best of your ability. The team over at Siimee values the answers you provide us so that we can show you results catered to your specific needs.
10
 </template>
11
 </template>

+ 8
- 2
frontend/src/entities/card/card.js Voir le fichier

71
         name: 'attention',
71
         name: 'attention',
72
         labels: ['guided', 'self-managed'],
72
         labels: ['guided', 'self-managed'],
73
     }),
73
     }),
74
+    new Aspect({
75
+        name: 'love-test',
76
+        labels: ['love', 'hate'],
77
+    }),
78
+
74
 ]
79
 ]
75
 
80
 
76
 const responseKeyIdToAspectName = {
81
 const responseKeyIdToAspectName = {
80
     4: 'precision',
85
     4: 'precision',
81
     5: 'focus',
86
     5: 'focus',
82
     6: 'attention',
87
     6: 'attention',
88
+    7: 'love-test',
83
 }
89
 }
84
 
90
 
85
 /**
91
 /**
133
     c.locale = `${profile.city}, ${profile.state}`
139
     c.locale = `${profile.city}, ${profile.state}`
134
     c.email = profile.user_email
140
     c.email = profile.user_email
135
 
141
 
136
-
137
-    let aspectResponses = profile?.responses.filter(r => [1,2,3,4,5,6].indexOf(r.response_key_id) !== -1)
142
+    // TO ADD ASPECT: when creating new survey aspect step, increment array.indexOf here
143
+    let aspectResponses = profile?.responses.filter(r => [1,2,3,4,5,6,7].indexOf(r.response_key_id) !== -1)
138
     if(aspectResponses.length){ // if user has responses for aspects we overwrite default percentages
144
     if(aspectResponses.length){ // if user has responses for aspects we overwrite default percentages
139
         c.aspects.map(a => {
145
         c.aspects.map(a => {
140
             a.percentage = Number(aspectResponses.find(r => responseKeyIdToAspectName[r.response_key_id] == a.name).val )
146
             a.percentage = Number(aspectResponses.find(r => responseKeyIdToAspectName[r.response_key_id] == a.name).val )

+ 2
- 0
frontend/src/entities/survey/survey.answer.schema.js Voir le fichier

21
         image: Joi.any(),
21
         image: Joi.any(),
22
         distance: Joi.string(),
22
         distance: Joi.string(),
23
         blurb: Joi.string(),
23
         blurb: Joi.string(),
24
+        // TO ADD: add Joi validator for all new survey steps
25
+        test: Joi.string(),
24
         aspects: Joi.array().items(Joi.number().allow(null))
26
         aspects: Joi.array().items(Joi.number().allow(null))
25
     }),
27
     }),
26
     validate(instance) {
28
     validate(instance) {

+ 2
- 1
frontend/src/entities/survey/survey.js Voir le fichier

3
 import { surveySchema } from './survey.schema.js'
3
 import { surveySchema } from './survey.schema.js'
4
 import { answersSchema } from './survey.answer.schema.js'
4
 import { answersSchema } from './survey.answer.schema.js'
5
 
5
 
6
-const SCORED = [1, 2, 3, 4, 5, 6]
6
+// TO ADD ASPECT: when creating new survey aspect step, add additional number here
7
+const SCORED = [1, 2, 3, 4, 5, 6, 7]
7
 const _isScored = id => SCORED.includes(id)
8
 const _isScored = id => SCORED.includes(id)
8
 const _makeCategoryFriendly = responseCategory => {
9
 const _makeCategoryFriendly = responseCategory => {
9
     const labels = responseCategory.split('_vs_')
10
     const labels = responseCategory.split('_vs_')

+ 1
- 1
frontend/src/utils/aspects.js Voir le fichier

32
     },
32
     },
33
 ]
33
 ]
34
 
34
 
35
-export default Aspects
35
+export default Aspects

+ 10
- 4
frontend/src/utils/lang.js Voir le fichier

17
         image: 'image',
17
         image: 'image',
18
         distance: 'distance',
18
         distance: 'distance',
19
         blurb: 'blurb',
19
         blurb: 'blurb',
20
+        // TO ADD: when creating a new step, place before aspects
21
+        test: 'test',
20
         aspects: 'aspects',
22
         aspects: 'aspects',
21
         // experience: 'experience',
23
         // experience: 'experience',
22
         // roles: 'role',
24
         // roles: 'role',
69
             'analyst',
71
             'analyst',
70
             'architect',
72
             'architect',
71
             'developer',
73
             'developer',
72
-            'engineer',
73
-            'manager',
74
-            'technician',
75
-        ],
74
+            'engineer', 'manager', 'technician', ],
76
         candidate: ['hiring_manager', 'recruiter'],
75
         candidate: ['hiring_manager', 'recruiter'],
77
     },
76
     },
78
     pronouns: ['she/her', 'she/they', 'he/him', 'he/they', 'they/them'],
77
     pronouns: ['she/her', 'she/they', 'he/him', 'he/they', 'they/them'],
79
     image: [],
78
     image: [],
80
     zipcode: [],
79
     zipcode: [],
81
     blurb: [],
80
     blurb: [],
81
+    test: []
82
 }
82
 }
83
 
83
 
84
 // TODO: set up a separate object of similar prompts based off of
84
 // TODO: set up a separate object of similar prompts based off of
98
     duration: "What kind of duration would you prefer? Are you looking for part-time, full-time, other?[break] Currently, I'm looking for a [break] job at this time.",
98
     duration: "What kind of duration would you prefer? Are you looking for part-time, full-time, other?[break] Currently, I'm looking for a [break] job at this time.",
99
     language: "What language is your native language?[break] I consider [break] language as my native language.",
99
     language: "What language is your native language?[break] I consider [break] language as my native language.",
100
     distance: "What distance from your home are you looking to work in?[break] Preferably, I'd like to work [break] from my place of residence.",
100
     distance: "What distance from your home are you looking to work in?[break] Preferably, I'd like to work [break] from my place of residence.",
101
+    // TO ADD: add new prompt for new survey steps here
102
+    test: 'this[break]is just[break] a test.'
101
 }
103
 }
102
 
104
 
103
 const inputPlaceholders = {
105
 const inputPlaceholders = {
107
     password: 'supersecr3tp@ssword',
109
     password: 'supersecr3tp@ssword',
108
     blurb: 'my backstory starts long long ago...',
110
     blurb: 'my backstory starts long long ago...',
109
     distance: '5 mi',
111
     distance: '5 mi',
112
+    // TO ADD: add new input place holder here
113
+    test: 'test'
110
 }
114
 }
111
 
115
 
112
 const invalidInputPrompts = {
116
 const invalidInputPrompts = {
123
     duration: "Looks like you haven't filled out what kind of work you're most interested in. As in, part-time, full-time. Take a look at our above options and choose whatever feels right for you right now. You can always edit them later!",
127
     duration: "Looks like you haven't filled out what kind of work you're most interested in. As in, part-time, full-time. Take a look at our above options and choose whatever feels right for you right now. You can always edit them later!",
124
     language: "We try our best to provide results in the language of your choosing. ¿Prefieres ver resultados en español? Or would you prefer to see results in english?",
128
     language: "We try our best to provide results in the language of your choosing. ¿Prefieres ver resultados en español? Or would you prefer to see results in english?",
125
     distance: "Whoa! You either left this field blank or tried to input an astronomically large distance you'd like to see results from. Please input a distance you'd like to see results in.",
129
     distance: "Whoa! You either left this field blank or tried to input an astronomically large distance you'd like to see results from. Please input a distance you'd like to see results in.",
130
+    // TO ADD: add new input invalid message here
131
+    test: 'oh goodness, why test this!'
126
 }
132
 }
127
 
133
 
128
 export {
134
 export {

+ 4
- 1
frontend/src/utils/survey.js Voir le fichier

17
     image: 'FormInput',
17
     image: 'FormInput',
18
     distance: 'FormInput',
18
     distance: 'FormInput',
19
     blurb: 'FormInput',
19
     blurb: 'FormInput',
20
+    // TO ADD: Add Component Type for new survey step here
21
+    test: 'FormInput',
20
     aspects: 'Aspects',
22
     aspects: 'Aspects',
21
     // experience: 'FormTags',
23
     // experience: 'FormTags',
22
     // role: 'FormDropdown',
24
     // role: 'FormDropdown',
80
         let unseen = this.questionsFromDb.filter(
82
         let unseen = this.questionsFromDb.filter(
81
             q =>
83
             q =>
82
                 !seenIds.includes(q.response_key_id) &&
84
                 !seenIds.includes(q.response_key_id) &&
83
-                [1, 2, 3, 4, 5, 6].includes(q.response_key_id),
85
+                // TO ADD ASPECTS: increment array here
86
+                [1, 2, 3, 4, 5, 6, 7].includes(q.response_key_id),
84
         )
87
         )
85
         return [...stepsInCommon, ...unseen]
88
         return [...stepsInCommon, ...unseen]
86
     }
89
     }

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

68
         updateAnswers(payload) {
68
         updateAnswers(payload) {
69
             // null payload is passed on splash page
69
             // null payload is passed on splash page
70
             if (payload) {
70
             if (payload) {
71
-                console.log('payload >>', payload)
72
                 this.invalidResponse = false
71
                 this.invalidResponse = false
73
                 const k = payload.question.survey_stage
72
                 const k = payload.question.survey_stage
74
                 this.answered[k] = payload.input
73
                 this.answered[k] = payload.input

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

13
         div(v-for='(aspect, index) in answers.aspects')
13
         div(v-for='(aspect, index) in answers.aspects')
14
             div(v-if='aspect')
14
             div(v-if='aspect')
15
                 p {{ surveyObjects[index].response_key_prompt }}
15
                 p {{ surveyObjects[index].response_key_prompt }}
16
-                p You Answered:  {{aspect}}
17
-                br
16
+                p You Answered: {{ aspect }}
18
         w-button.ma1(@click="changeAnswers") Change Answers
17
         w-button.ma1(@click="changeAnswers") Change Answers
19
         w-button.ma1(@click="finalSubmit") Submit Answers
18
         w-button.ma1(@click="finalSubmit") Submit Answers
20
 </template>
19
 </template>
35
         surveyObjects: [],
34
         surveyObjects: [],
36
     }),
35
     }),
37
     created() {
36
     created() {
38
-        this.surveyObjects = this.surveySteps.slice(-6)
37
+        // TO ADD ASPECT: when creating new survey aspect step, increment slice number here
38
+        this.surveyObjects = this.surveySteps.slice(-7)
39
     },
39
     },
40
 }
40
 }
41
 </script>
41
 </script>

Chargement…
Annuler
Enregistrer