Skip to content

Commit a82793e

Browse files
committed
updating thr way how survey calculate the progress; passing mp_progress from SurveyItem
1 parent 4a1c3be commit a82793e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/components/Survey/Survey.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
<survey-item
2929
:key="'c' + content['@id']"
3030
v-if="shouldShow[index]"
31-
:item="content" :index="contextReverse.length - index - 1"
31+
:item="content"
32+
:index="contextReverse.length - index - 1"
3233
:init="responses[content['@id']]"
3334
v-on:skip="nextQuestion(contextReverse.length - index - 1, 1, 0)"
3435
v-on:dontKnow="nextQuestion(contextReverse.length - index - 1, 0, 1)"
@@ -245,7 +246,7 @@
245246
return criteria1 && criteria2;
246247
});
247248
},
248-
setResponse(val, index) {
249+
setResponse(val, index, mp_progress=100) {
249250
const itemUrl = this.context[index]['@id'];
250251
let exportVal = val;
251252
let usedList = [];
@@ -319,7 +320,7 @@
319320
this.$emit('saveScores', this.srcUrl, this.scores);
320321
}
321322
}
322-
this.updateProgress();
323+
this.updateProgress(mp_progress);
323324
},
324325
setScore(scoreObj, index) {
325326
this.$emit('saveScores', this.context[index]['@id'], scoreObj);
@@ -406,7 +407,7 @@
406407
}
407408
return {};
408409
},
409-
updateProgress() {
410+
updateProgress(mp_pr=100) {
410411
let totalQ = this.context.length;
411412
if (!_.isEmpty(this.visibility)) {
412413
totalQ = 0;
@@ -420,7 +421,7 @@
420421
});
421422
// totalQ = _.filter(this.visibility).length;
422423
}
423-
const progress = ((Object.keys(this.responses).length) / totalQ) * 100;
424+
const progress = ((Object.keys(this.responses).length - 1 + mp_pr/100) / totalQ) * 100;
424425
// console.log(401, 'updateProgress------ ', Object.keys(this.responses).length, totalQ, this.context, this.context.length, progress)
425426
this.$emit('updateProgress', progress);
426427
},

src/components/SurveyItem/SurveyItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@
357357
sendData(val) {
358358
this.variant = null;
359359
/* eslint-enable */
360-
this.$emit('setData', val, this.index);
360+
this.$emit('setData', val, this.index, this.mp_progress);
361361
},
362362
sendDataAndGoNext(val) {
363363
// console.log('sending data and going next', val);

0 commit comments

Comments
 (0)