Bladeren bron

:construction: WIP dynamic spider chart

tags/0.0.3^2
juancarbajal98 3 jaren geleden
bovenliggende
commit
3211a89b96
3 gewijzigde bestanden met toevoegingen van 16 en 3 verwijderingen
  1. 3
    3
      frontend/src/components/SummaryBar.vue
  2. 11
    0
      frontend/src/entities/card/card.js
  3. 2
    0
      frontend/src/views/HomeView.vue

+ 3
- 3
frontend/src/components/SummaryBar.vue Bestand weergeven

@@ -30,7 +30,7 @@ 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='profileScore'
33
+                        :profile-data='aspects.map(data => data.percentage * 10)'
34 34
                         :target-data='targetScore'
35 35
                         profile-name='lucy'
36 36
                         v-if='isTab'
@@ -87,8 +87,8 @@ export default {
87 87
     },
88 88
     emits: ['tab-change'],
89 89
     data: () => ({
90
-        profileScore: [5.7, 5.2, 4.8, 5.2, 4.9, 4.9],
91
-        targetScore: [5.3, 4.8, 5.7, 4.8, 5.6, 4.8],
90
+        // profileScore: [5.7, 5.2, 4.8, 5.2, 4.9, 4.9], // lucy 
91
+        targetScore: [5.3, 4.8, 5.7, 4.8, 5.6, 4.8], // Role
92 92
     }),
93 93
     methods: {
94 94
         onTabChanged(tabs) {

+ 11
- 0
frontend/src/entities/card/card.js Bestand weergeven

@@ -123,6 +123,17 @@ const makeCardFromProfile = profile => {
123 123
     c.ethinicity = profile?.profile_prefs?.ethnicity?.val
124 124
     c.locale = `${profile.city}, ${profile.state}`
125 125
     c.email = profile.user_email
126
+
127
+
128
+    console.log(`RESP: ${profile?.responses}`)
129
+    let aspectResponses = profile?.responses.filter(r => r.response_id == 'aspect')
130
+    if(aspectResponses.length){ // if user has responses for aspects we overwrite default percentages
131
+        c.aspects.map(a => {
132
+            a.percentage = aspectResponses.find(r => r.response_key_id == a.name).val // depends on DB structure
133
+            return a 
134
+        })
135
+    }
136
+
126 137
     // TODO: delete me later
127 138
     if (profile.profile_description) {
128 139
         c.summary.updateTab('about', profile.profile_description)

+ 2
- 0
frontend/src/views/HomeView.vue Bestand weergeven

@@ -1,5 +1,6 @@
1 1
 <template lang="pug">
2 2
 main.view--home
3
+    p {{cP._profile.user_name}}
3 4
     article.w-flex.column.align-center
4 5
         template(v-if='isLoading')
5 6
             w-spinner(bounce)
@@ -61,6 +62,7 @@ export default {
61 62
     },
62 63
     mixins: [mixins.profileMixin],
63 64
     computed: {
65
+        cP() {return currentProfile},
64 66
         cards() {
65 67
             return currentProfile.queue.map(qProfile => convertToCard(qProfile))
66 68
         },

Laden…
Annuleren
Opslaan