Skip to content

Commit

Permalink
chore: remove unwanted code
Browse files Browse the repository at this point in the history
  • Loading branch information
9sneha-n committed Nov 10, 2024
1 parent c68fb01 commit 844e44e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/domain/entities/Questionnaire/QuestionnaireQuestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class QuestionnaireQuestion {
.value();
processedQuestions.push(updatedQuestion);

//3. Get all questions that need to be updated as a side effect of the current question update
//2. Get all questions that need to be updated as a side effect of the current question update
const allQuestionIdsRequiringUpdate = _(
questionnaire.rules.flatMap(rule => {
if (
Expand All @@ -205,15 +205,15 @@ export class QuestionnaireQuestion {
);
if (allQuestionsRequiringUpdate.length === 0) return sortedUpdatedQuestions;

//4. Recursively update all questions that need to be updated as a side effect of the current question update
//3. Recursively update all questions that need to be updated as a side effect of the current question update
const finalUpdatesWithSideEffects = allQuestionsRequiringUpdate.reduce(
(acc, questionRequiringUpdate) => {
const currentApplicableRules = getApplicableRules(
questionRequiringUpdate,
questionnaire.rules,
acc
);
//5. Maintain a dependency graph to avoid infinite recursive calls,
//4. Maintain a dependency graph to avoid infinite recursive calls,
// once a question has been processed, it should not be processed again
processedQuestions.push(questionRequiringUpdate);
const updates = this.updateQuestions(
Expand All @@ -223,9 +223,6 @@ export class QuestionnaireQuestion {
currentApplicableRules,
questionnaire
);
//6. If "side-effect" question is hidden, reset its value
// const updatedQuestion = updates.find(q => q.id === questionRequiringUpdate.id);

return updates;
},
sortedUpdatedQuestions
Expand Down

0 comments on commit 844e44e

Please sign in to comment.