Skip to content
Snippets Groups Projects
Commit 85c3275a authored by Saket Agrahari's avatar Saket Agrahari
Browse files

[COMP-253][COMP-254] Progress Bar

parent 8ae7bea1
Branches
Tags
1 merge request!65progress bar issue [COMP-253][COMP-254]
......@@ -14,6 +14,18 @@ function ProgressBar({ surveyModel, pageNoSetter }) {
const filterCallback = (question) => {
const typesWithLengthCheck = ["checkbox", "text","comment","multipletext"];
if (typesWithLengthCheck.includes(question.getType())) {
if (question.value !== null && question.value !== undefined) {
if (question.value.length > 0) {
console.log("question.type len",question.getType())
return true; // Non-empty array
} else if (Object.keys(question.value).length > 0 && question.getType()==="multipletext") {
return Object.values(question.value)[0]!== undefined;
}// Non-empty multitext object
}
return false;
}
return question.value !== null && question.value !== undefined;
};
......@@ -31,6 +43,16 @@ function ProgressBar({ surveyModel, pageNoSetter }) {
const answeredCount = sectionQuestions.filter(filterCallback).length;
const unansweredCount = questionCount - answeredCount;
const completionPercentage = answeredCount / questionCount;
// console.log("sectionQuestions:",sectionQuestions)
if(answeredCount>0){
// console.log("answeredQuestion:",sectionQuestions.filter(filterCallback))
// console.log("questionCount: ",questionCount)
// console.log("answeredCount: ",answeredCount)
}
// console.log("unansweredCount: ",unansweredCount)
// console.log("completionPercentage: ",completionPercentage)
progressArray.push({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment