hello recently i asked a support question on getting custom values and the end of a survey the code posted is below
survey
.onComplete
.add(function (result) {
var totalScore = result.getAllQuestions().reduce(function(total, q) {
if(Array.isArray(q.choices)) {
return q.choices.reduce(function(s, c) {
if(q.value.indexOf(c.value) !== -1) {
s += c.points
}
return s;
}, total);
}
return total;
}, 0);
console.log(totalScore);
});
my question is how do i get only the questions that have been answered in this way as this seem to return all the questions even questions that we not selected. it also gives an error on visible if and nested visible if with indexof error.