Просмотр исходного кода

:construction: WIP dynamic spider chart

tabs-content
juancarbajal98 3 лет назад
Родитель
Сommit
304bd2a634

+ 14
- 13
frontend/src/components/SummaryBar.vue Просмотреть файл

@@ -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
 
@@ -88,9 +88,9 @@ export default {
88 88
             required: true,
89 89
             type: Object,
90 90
         },
91
-        name:{
92
-            required:true,
93
-            type: String
91
+        name: {
92
+            required: true,
93
+            type: String,
94 94
         },
95 95
         isTab: {
96 96
             required: false,
@@ -136,16 +136,17 @@ export default {
136 136
         },
137 137
     }),
138 138
     computed: {
139
-        targetScore(){
140
-            try{
141
-                let aspectResponses = currentProfile._profile.responses.filter(r => [1,2,3,4,5,6].indexOf(r.response_key_id) !== -1)
142
-                return aspectResponses.map(r => Number(r.val)) 
143
-            }
144
-            catch(e){
139
+        targetScore() {
140
+            try {
141
+                let aspectResponses = currentProfile._profile.responses.filter(
142
+                    r => [1, 2, 3, 4, 5, 6].indexOf(r.response_key_id) !== -1,
143
+                )
144
+                return aspectResponses.map(r => Number(r.val))
145
+            } catch (e) {
145 146
                 console.warn('error: No aspect responses for current profile.')
146
-                return [1,1,1,1,1,1]
147
+                return [1, 1, 1, 1, 1, 1]
147 148
             }
148
-        }
149
+        },
149 150
     },
150 151
     methods: {
151 152
         onTabChanged(tabs) {

+ 12
- 6
frontend/src/entities/card/card.js Просмотреть файл

@@ -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 Просмотреть файл

@@ -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),

Загрузка…
Отмена
Сохранить