|
|
@@ -58,6 +58,7 @@ import Joi from 'joi'
|
|
58
|
58
|
import { validatorMapping, makeKebob } from '@/utils'
|
|
59
|
59
|
import { defineProps, reactive, ref } from 'vue'
|
|
60
|
60
|
import { saveSurveyByProfileID, scoreSurveyByProfileId } from '../services/survey.service'
|
|
|
61
|
+import { fetchMembershipsByProfileId, postMembershipByProfileId } from '../services/grouping.service'
|
|
61
|
62
|
|
|
62
|
63
|
const slidevalue = ref('0')
|
|
63
|
64
|
|
|
|
@@ -128,13 +129,20 @@ const next = e => {
|
|
128
|
129
|
// Bc we don't want to pass the 1st question to backend & we want profileId
|
|
129
|
130
|
// Necessary atm bc we manually added question in Survey class (entity)
|
|
130
|
131
|
const profileId = idWithResponseVal.shift().val
|
|
131
|
|
- // TODO: pass maxDistance from an input value somewhere later
|
|
|
132
|
+ const targetId = 0
|
|
132
|
133
|
const maxDistance = 10
|
|
133
|
134
|
saveSurveyByProfileID(idWithResponseVal, profileId)
|
|
134
|
135
|
alert('Responses submitted!')
|
|
135
|
136
|
resetAnswers()
|
|
136
|
|
- // TODO: score here after save survey responses
|
|
137
|
137
|
scoreSurveyByProfileId(profileId, maxDistance)
|
|
|
138
|
+
|
|
|
139
|
+ const checkMembership = fetchMembershipsByProfileId(profileId)
|
|
|
140
|
+ console.log(checkMembership)
|
|
|
141
|
+ if (!checkMembership) {
|
|
|
142
|
+ console.log('Make membership')
|
|
|
143
|
+ // postMembershipByProfileId({ profileId, targetId })
|
|
|
144
|
+ }
|
|
|
145
|
+
|
|
138
|
146
|
state.step = 1
|
|
139
|
147
|
} else if (state.step < props.form.length) {
|
|
140
|
148
|
state.step++
|