Quellcode durchsuchen

:bug: Addressing reveal bug, in progress...

tags/0.0.3^2
tomit4 vor 3 Jahren
Ursprung
Commit
77835c6c5e

+ 2
- 1
.gitignore Datei anzeigen

6
 **/.env
6
 **/.env
7
 .nyc_output
7
 .nyc_output
8
 **/generated/_*
8
 **/generated/_*
9
-**/.vscode
9
+**/.vscode
10
+**/*.vim

+ 2
- 1
backend/lib/routes/membership/reveal.js Datei anzeigen

50
                 const idsInGroup = memberships.map(
50
                 const idsInGroup = memberships.map(
51
                     membership => membership.profile_id,
51
                     membership => membership.profile_id,
52
                 )
52
                 )
53
-
53
+                if (idsInGroup.length > 2)
54
+                    return console.error('ERROR: idsInGroup cannot have more than 2 entries: ', idsInGroup)
54
                 // Grab User Info from Users Table
55
                 // Grab User Info from Users Table
55
                 const completeProfile = await profileService.getProfilesFor([profile_id], 'participant')
56
                 const completeProfile = await profileService.getProfilesFor([profile_id], 'participant')
56
 
57
 

+ 4
- 1
backend/lib/services/profile/index.js Datei anzeigen

63
             tag => this.tagLookup[tag.tag_id],
63
             tag => this.tagLookup[tag.tag_id],
64
         )
64
         )
65
         const complete = new profiler.CompleteProfile(matchingProfile, true)
65
         const complete = new profiler.CompleteProfile(matchingProfile, true)
66
-        return this.setDefaults(complete)
66
+        // TODO: Refactor to use this.setDefaults(), currently does not play
67
+        // nice with reveal functionality
68
+        return complete
69
+        // return this.setDefaults(complete)
67
     }
70
     }
68
 
71
 
69
     async getCompleteProfilesFor(userId, type) {
72
     async getCompleteProfilesFor(userId, type) {

+ 0
- 1
frontend/src/components/ProfileCard.vue Datei anzeigen

67
 
67
 
68
 const router = useRouter()
68
 const router = useRouter()
69
 const isPaired = ref(true)
69
 const isPaired = ref(true)
70
-// const isPaired = ref(false)
71
 
70
 
72
 const props = defineProps({
71
 const props = defineProps({
73
     card: {
72
     card: {

+ 3
- 1
frontend/src/entities/response/response.schema.js Datei anzeigen

8
     profile_id: Joi.number(),
8
     profile_id: Joi.number(),
9
     response_id: Joi.number(),
9
     response_id: Joi.number(),
10
     response_key_id: Joi.number(),
10
     response_key_id: Joi.number(),
11
-    val: Joi.string(),
11
+    // TODO: troubleshoot later, suppressed validation warning for now
12
+    // val: Joi.string(),
13
+    val: Joi.any(),
12
 })
14
 })
13
 
15
 
14
 export { responseSchema }
16
 export { responseSchema }

+ 2
- 1
frontend/src/services/grouping.service.js Datei anzeigen

1
 import { db } from '../utils/db.js'
1
 import { db } from '../utils/db.js'
2
 import { Grouping, Profile } from '../entities/index.js'
2
 import { Grouping, Profile } from '../entities/index.js'
3
-
3
+import { ref } from 'vue'
4
 /**
4
 /**
5
  * Get Memberships associated with a single Profile from the database and
5
  * Get Memberships associated with a single Profile from the database and
6
  * create a class from the data and
6
  * create a class from the data and
26
                     `/profile/${profileId}/tags/${grouping.grouping_id}`,
26
                     `/profile/${profileId}/tags/${grouping.grouping_id}`,
27
                 )
27
                 )
28
                 grouping.tags = [...targetTags, ...profileTags]
28
                 grouping.tags = [...targetTags, ...profileTags]
29
+                grouping.revealedFromNotification = ref([])
29
                 grouping._loading.value = false
30
                 grouping._loading.value = false
30
                 validGroupingInstances.push(grouping)
31
                 validGroupingInstances.push(grouping)
31
             }
32
             }

+ 4
- 2
frontend/src/services/notification.service.js Datei anzeigen

52
                 is_active: 1,
52
                 is_active: 1,
53
                 tag_category: "reveal",
53
                 tag_category: "reveal",
54
                 tag_description: parsed.description,
54
                 tag_description: parsed.description,
55
-                tag_id: parsed.tag
55
+                tag_id: parsed.tag,
56
+                for_profile_id: foundGrouping.profile.profile_id
56
             }
57
             }
57
             const target_desc = parsed.description
58
             const target_desc = parsed.description
58
             tagFromNotification[target_desc] = parsed.revealed_info
59
             tagFromNotification[target_desc] = parsed.revealed_info
59
-            foundGrouping.profile.tags.push(tagFromNotification)
60
+            foundGrouping.profile.reveal.push(tagFromNotification)
61
+            foundGrouping.revealedFromNotification.value.push(tagFromNotification)
60
         }
62
         }
61
     }
63
     }
62
 }
64
 }

+ 18
- 9
frontend/src/views/ChatView.vue Datei anzeigen

15
                 button(@click='reveal(8)') reveal my email
15
                 button(@click='reveal(8)') reveal my email
16
                 // TODO: Remove later, only for testing
16
                 // TODO: Remove later, only for testing
17
                 button(@click='checkData()') check data
17
                 button(@click='checkData()') check data
18
+            // BUG: grouping.revealed[profile.id.value] needs to be deduped
18
             p you revealed:
19
             p you revealed:
19
                 span(v-if="grouping.revealed[profile.id.value]")
20
                 span(v-if="grouping.revealed[profile.id.value]")
20
                     ul(v-for="reveal in grouping.revealed[profile.id.value]")
21
                     ul(v-for="reveal in grouping.revealed[profile.id.value]")
21
-                        li {{ reveal.description }} : {{ profile._profile[reveal.description] }}
22
+                        li {{ reveal.description }}: {{ profile._profile[reveal.description] }}
23
+            // BUG: they revealed doesn't persist, both for loops are currently necessary
22
             p they revealed:
24
             p they revealed:
23
-                span(v-if="theyRevealed")
24
-                    ul(v-for="reveal in theyRevealed")
25
-                        li {{ reveal.description }} : {{ grouping.profile[reveal.description] }}
25
+                // BUG: persists, but doesn't display upon reveal
26
+                span(v-if="grouping.revealed[target.profile_id]")
27
+                    ul(v-for="reveal in grouping.revealed[target.profile_id]")
28
+                        li {{ reveal.description }}: {{ target[reveal.description] }}
29
+            // BUG: reveals, but does not persist
30
+            ul(v-for="revealed in grouping.revealedFromNotification")
31
+                li(v-if="revealed[revealed.tag_description] !== profile._profile[revealed.tag_description]") {{ revealed.tag_description }}: {{ revealed[revealed.tag_description] }}
26
 
32
 
27
     article
33
     article
28
         template(v-if='isLoading')
34
         template(v-if='isLoading')
66
         toSend: '',
72
         toSend: '',
67
         messages: [],
73
         messages: [],
68
         grouping: {},
74
         grouping: {},
75
+        them: {},
69
     }),
76
     }),
70
     // TODO: Make sure grouping.profile.profile_id actually exists
77
     // TODO: Make sure grouping.profile.profile_id actually exists
71
     computed: {
78
     computed: {
72
         theyRevealed() {
79
         theyRevealed() {
73
-            return this.grouping && this.grouping.revealed[this.grouping.profile.profile_id] ?
74
-                this.grouping.revealed[this.grouping.profile.profile_id] :
75
-                []
76
-        }
80
+            return this.them
81
+        },
77
     },
82
     },
78
     watch: {
83
     watch: {
79
         async profile() {
84
         async profile() {
88
         this.loadTargetProfile()
93
         this.loadTargetProfile()
89
         currentProfile._loading.value = true
94
         currentProfile._loading.value = true
90
         this.grouping = this.getGrouping()
95
         this.grouping = this.getGrouping()
96
+        this.them = this.grouping.profile
91
         this.messages = await currentProfile.chatter.getHistory(this.grouping.grouping_name)
97
         this.messages = await currentProfile.chatter.getHistory(this.grouping.grouping_name)
92
         console.log('this.messages :>> ', this.messages)
98
         console.log('this.messages :>> ', this.messages)
93
         currentProfile.chatter.setOnMessage(this._onMessage)
99
         currentProfile.chatter.setOnMessage(this._onMessage)
100
          },
106
          },
101
         // TODO: remove, only for testing reveal()
107
         // TODO: remove, only for testing reveal()
102
         async checkData() {
108
         async checkData() {
103
-            console.log(currentProfile)
109
+            console.log('currentProfile :=>', currentProfile)
104
         },
110
         },
105
         /**
111
         /**
106
          * Pubnub message callback fires when message event
112
          * Pubnub message callback fires when message event
113
         },
119
         },
114
         // TODO: test this
120
         // TODO: test this
115
         getGrouping() {
121
         getGrouping() {
122
+            if (this.$route.params.pid === currentProfile.profile_id) {
123
+                console.warn('WARNING :=> You cannot chat with yourself!!!')
124
+            }
116
             return currentProfile.groupings.find(
125
             return currentProfile.groupings.find(
117
                 g => g.profile.profile_id == this.$route.params.pid,
126
                 g => g.profile.profile_id == this.$route.params.pid,
118
             )
127
             )

Laden…
Abbrechen
Speichern