Przeglądaj źródła

:construction: WIP dynamic spider chart

tags/0.0.3^2
juancarbajal98 3 lat temu
rodzic
commit
333896c5c9

+ 14
- 13
frontend/src/components/SummaryBar.vue Wyświetl plik

@@ -30,9 +30,9 @@ section.w-flex.column.pb5
30 30
                     p {{ tabContent[item].tab }}
31 31
                     SpiderChart(
32 32
                         :labels='aspects.map(label => label.name)'
33
-                        :profile-data='aspects.map(data => data.percentage)'
34
-                        :target-data='targetScore'
33
+                        :profile-data='aspects.map(data => data.percentage * 10)'
35 34
                         :profile-name='name'
35
+                        :target-data='targetScore'
36 36
                         v-if='isTab'
37 37
                     )
38 38
 
@@ -75,9 +75,9 @@ export default {
75 75
             required: true,
76 76
             type: Object,
77 77
         },
78
-        name:{
79
-            required:true,
80
-            type: String
78
+        name: {
79
+            required: true,
80
+            type: String,
81 81
         },
82 82
         isTab: {
83 83
             required: false,
@@ -92,16 +92,17 @@ export default {
92 92
     },
93 93
     emits: ['tab-change'],
94 94
     computed: {
95
-        targetScore(){
96
-            try{
97
-                let aspectResponses = currentProfile._profile.responses.filter(r => [1,2,3,4,5,6].indexOf(r.response_key_id) !== -1)
98
-                return aspectResponses.map(r => Number(r.val)) 
99
-            }
100
-            catch(e){
95
+        targetScore() {
96
+            try {
97
+                let aspectResponses = currentProfile._profile.responses.filter(
98
+                    r => [1, 2, 3, 4, 5, 6].indexOf(r.response_key_id) !== -1,
99
+                )
100
+                return aspectResponses.map(r => Number(r.val))
101
+            } catch (e) {
101 102
                 console.warn('error: No aspect responses for current profile.')
102
-                return [1,1,1,1,1,1]
103
+                return [1, 1, 1, 1, 1, 1]
103 104
             }
104
-        }
105
+        },
105 106
     },
106 107
     methods: {
107 108
         onTabChanged(tabs) {

+ 12
- 6
frontend/src/entities/card/card.js Wyświetl plik

@@ -1,5 +1,5 @@
1 1
 /** @module card/card */
2
-import { aspectsArr } from "../../utils/lang.js"
2
+import { aspectsArr } from '../../utils/lang.js'
3 3
 
4 4
 const DEFAULT_ABOUT =
5 5
     'Hello! My name is L.L. and I am a nurse from New York. I have been in the healthcare industry for over 6 years.'
@@ -134,14 +134,20 @@ const makeCardFromProfile = profile => {
134 134
     c.locale = `${profile.city}, ${profile.state}`
135 135
     c.email = profile.user_email
136 136
 
137
-    let aspectResponses = profile?.responses.filter(r => aspectsArr.indexOf(r.response_key_id) !== -1)
138
-    if(aspectResponses.length){ // if user has responses for aspects we overwrite default percentages
137
+    let aspectResponses = profile?.responses.filter(
138
+        r => aspectsArr.indexOf(r.response_key_id) !== -1,
139
+    )
140
+    if (aspectResponses.length) {
141
+        // if user has responses for aspects we overwrite default percentages
139 142
         c.aspects.map(a => {
140
-            a.percentage = Number(aspectResponses.find(r => responseKeyIdToAspectName[r.response_key_id] == a.name).val )
141
-            return a 
143
+            a.percentage = Number(
144
+                aspectResponses.find(
145
+                    r => responseKeyIdToAspectName[r.response_key_id] == a.name,
146
+                ).val,
147
+            )
148
+            return a
142 149
         })
143 150
     }
144
-
145 151
     // TODO: delete me later
146 152
     if (profile.profile_description) {
147 153
         c.summary.updateTab('about', profile.profile_description)

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

@@ -1,6 +1,7 @@
1 1
 <template lang="pug">
2 2
 main.view--home
3
-    article.w-flex.sm-column.md-row.align-center
3
+    p {{cP._profile.user_name}}
4
+    article.w-flex.column.align-center
4 5
         template(v-if='isLoading')
5 6
             w-spinner(bounce)
6 7
 
@@ -70,6 +71,7 @@ export default {
70 71
         }
71 72
     },
72 73
     computed: {
74
+        cP() {return currentProfile},
73 75
         cards() {
74 76
             let initialCards = currentProfile.queue.map(qProfile =>
75 77
                 convertToCard(qProfile),

Ładowanie…
Anuluj
Zapisz