浏览代码

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

tags/0.0.3^2
tomit4 3 年前
父节点
当前提交
8909c1672d

+ 30
- 21
backend/db/data-generator/mock.js 查看文件

@@ -430,109 +430,118 @@ module.exports = {
430 430
         {
431 431
             response_key_id: 1,
432 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 434
             response_key_description: 'first round draft scoring question',
436 435
         },
437 436
         {
438 437
             response_key_id: 2,
439 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 440
             response_key_description: 'first round draft scoring question',
443 441
         },
444 442
         {
445 443
             response_key_id: 3,
446 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 446
             response_key_description: 'first round draft scoring question',
450 447
         },
451 448
         {
452 449
             response_key_id: 4,
453 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 452
             response_key_description: 'first round draft scoring question',
457 453
         },
458 454
         {
459 455
             response_key_id: 5,
460 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 458
             response_key_description: 'first round draft scoring question',
464 459
         },
465 460
         {
466 461
             response_key_id: 6,
467 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 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 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 475
             response_key_category: 'profile',
475 476
             response_key_prompt: 'zipcode',
476 477
             response_key_description: 'required for distance calculations',
477 478
         },
478 479
         {
479
-            response_key_id: 8,
480
+            response_key_id: 9,
480 481
             response_key_category: 'profile',
481 482
             response_key_prompt: 'image',
482 483
             response_key_description: 'required for profile pictures',
483 484
         },
484 485
         {
485
-            response_key_id: 9,
486
+            response_key_id: 10,
486 487
             response_key_category: 'profile',
487 488
             response_key_prompt: 'language',
488 489
             response_key_description:
489 490
                 'programming and spoken language preference',
490 491
         },
491 492
         {
492
-            response_key_id: 10,
493
+            response_key_id: 11,
493 494
             response_key_category: 'profile',
494 495
             response_key_prompt: 'duration',
495 496
             response_key_description:
496 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 501
             response_key_category: 'profile',
501 502
             response_key_prompt: 'presence',
502 503
             response_key_description:
503 504
                 'location preference for where work happens',
504 505
         },
505 506
         {
506
-            response_key_id: 12,
507
+            response_key_id: 13,
507 508
             response_key_category: 'profile',
508 509
             response_key_prompt: 'blurb',
509 510
             response_key_description: 'required for profile description',
510 511
         },
511 512
         {
512
-            response_key_id: 13,
513
+            response_key_id: 14,
513 514
             response_key_category: 'profile',
514 515
             response_key_prompt: 'urgency',
515 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 520
             response_key_category: 'profile',
520 521
             response_key_prompt: 'role',
521 522
             response_key_description: 'current and desired role',
522 523
         },
523 524
         {
524
-            response_key_id: 15,
525
+            response_key_id: 16,
525 526
             response_key_category: 'profile',
526 527
             response_key_prompt: 'pronouns',
527 528
             response_key_description: 'required for profile pronouns',
528 529
         },
529 530
         {
530
-            response_key_id: 16,
531
+            response_key_id: 17,
531 532
             response_key_category: 'profile',
532 533
             response_key_prompt: 'distance',
533 534
             response_key_description:
534 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 546
     responses: [],
538 547
     memberships: [

+ 4
- 2
frontend/src/components/onboarding/Aspects.vue 查看文件

@@ -5,13 +5,15 @@ p(v-for='question in aspectQuestions')
5 5
         :question='question' 
6 6
         @updated='updateRadio'
7 7
         @updateIsAnswered='updateIsAnswered'
8
-        v-if='question.isBeingAnswered' @update-all='updateAll'
8
+        @update-all='updateAll'
9
+        v-if='question.isBeingAnswered' 
9 10
     )
10 11
 </template>
11 12
 
12 13
 <script>
13 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 18
 export default {
17 19
     name: 'Aspects',

+ 2
- 1
frontend/src/components/onboarding/QuestionResponse.vue 查看文件

@@ -4,7 +4,8 @@ w-card.question
4 4
     section.radio-buttons.w-flex.row.justify-space-between
5 5
         p(v-for="label in question.labels") {{label}}
6 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 9
     w-button.ma1.grow(v-else @click="updateAll") SUBMIT ANSWERS
9 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 11
 </template>

+ 8
- 2
frontend/src/entities/card/card.js 查看文件

@@ -71,6 +71,11 @@ const cardAspects = [
71 71
         name: 'attention',
72 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 81
 const responseKeyIdToAspectName = {
@@ -80,6 +85,7 @@ const responseKeyIdToAspectName = {
80 85
     4: 'precision',
81 86
     5: 'focus',
82 87
     6: 'attention',
88
+    7: 'love-test',
83 89
 }
84 90
 
85 91
 /**
@@ -133,8 +139,8 @@ const makeCardFromProfile = profile => {
133 139
     c.locale = `${profile.city}, ${profile.state}`
134 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 144
     if(aspectResponses.length){ // if user has responses for aspects we overwrite default percentages
139 145
         c.aspects.map(a => {
140 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 查看文件

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

+ 2
- 1
frontend/src/entities/survey/survey.js 查看文件

@@ -3,7 +3,8 @@ import { _baseRecord } from '../index.js'
3 3
 import { surveySchema } from './survey.schema.js'
4 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 8
 const _isScored = id => SCORED.includes(id)
8 9
 const _makeCategoryFriendly = responseCategory => {
9 10
     const labels = responseCategory.split('_vs_')

+ 1
- 1
frontend/src/utils/aspects.js 查看文件

@@ -32,4 +32,4 @@ const Aspects = [
32 32
     },
33 33
 ]
34 34
 
35
-export default Aspects
35
+export default Aspects

+ 10
- 4
frontend/src/utils/lang.js 查看文件

@@ -17,6 +17,8 @@ const allSteps = {
17 17
         image: 'image',
18 18
         distance: 'distance',
19 19
         blurb: 'blurb',
20
+        // TO ADD: when creating a new step, place before aspects
21
+        test: 'test',
20 22
         aspects: 'aspects',
21 23
         // experience: 'experience',
22 24
         // roles: 'role',
@@ -69,16 +71,14 @@ possible.usa = {
69 71
             'analyst',
70 72
             'architect',
71 73
             'developer',
72
-            'engineer',
73
-            'manager',
74
-            'technician',
75
-        ],
74
+            'engineer', 'manager', 'technician', ],
76 75
         candidate: ['hiring_manager', 'recruiter'],
77 76
     },
78 77
     pronouns: ['she/her', 'she/they', 'he/him', 'he/they', 'they/them'],
79 78
     image: [],
80 79
     zipcode: [],
81 80
     blurb: [],
81
+    test: []
82 82
 }
83 83
 
84 84
 // TODO: set up a separate object of similar prompts based off of
@@ -98,6 +98,8 @@ const promptOverrides = {
98 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 99
     language: "What language is your native language?[break] I consider [break] language as my native language.",
100 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 105
 const inputPlaceholders = {
@@ -107,6 +109,8 @@ const inputPlaceholders = {
107 109
     password: 'supersecr3tp@ssword',
108 110
     blurb: 'my backstory starts long long ago...',
109 111
     distance: '5 mi',
112
+    // TO ADD: add new input place holder here
113
+    test: 'test'
110 114
 }
111 115
 
112 116
 const invalidInputPrompts = {
@@ -123,6 +127,8 @@ const invalidInputPrompts = {
123 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 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 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 134
 export {

+ 4
- 1
frontend/src/utils/survey.js 查看文件

@@ -17,6 +17,8 @@ const promptToComponent = {
17 17
     image: 'FormInput',
18 18
     distance: 'FormInput',
19 19
     blurb: 'FormInput',
20
+    // TO ADD: Add Component Type for new survey step here
21
+    test: 'FormInput',
20 22
     aspects: 'Aspects',
21 23
     // experience: 'FormTags',
22 24
     // role: 'FormDropdown',
@@ -80,7 +82,8 @@ class SurveyFactory {
80 82
         let unseen = this.questionsFromDb.filter(
81 83
             q =>
82 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 88
         return [...stepsInCommon, ...unseen]
86 89
     }

+ 0
- 1
frontend/src/views/OnboardingView.vue 查看文件

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

+ 3
- 3
frontend/src/views/SurveyCompleteView.vue 查看文件

@@ -13,8 +13,7 @@ main.view--surveycomplete
13 13
         div(v-for='(aspect, index) in answers.aspects')
14 14
             div(v-if='aspect')
15 15
                 p {{ surveyObjects[index].response_key_prompt }}
16
-                p You Answered:  {{aspect}}
17
-                br
16
+                p You Answered: {{ aspect }}
18 17
         w-button.ma1(@click="changeAnswers") Change Answers
19 18
         w-button.ma1(@click="finalSubmit") Submit Answers
20 19
 </template>
@@ -35,7 +34,8 @@ export default {
35 34
         surveyObjects: [],
36 35
     }),
37 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 41
 </script>

正在加载...
取消
保存