Skip to content

Commit

Permalink
fix: The user remains on the input screen after selecting the respons…
Browse files Browse the repository at this point in the history
…e and tapping 'Next' M2-8294 (#912)

Co-authored-by: Felipe Imperio <felipeimp@Felipes-MacBook-Pro.local>
  • Loading branch information
2 people authored and ChaconC committed Dec 6, 2024
1 parent 4dc4db4 commit ed9e49f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/features/pass-survey/model/AnswerValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ export function AnswerValidator(
return null;
};

const getSelectionRowOptionValue = (rowIndex: number): string | null => {
const answer = currentAnswer?.answer as Maybe<
{ id: string; text: string }[]
>;

if (answer && answer[rowIndex]) {
const optionIds = answer[rowIndex].id;

return optionIds;
}
return null;
};

return {
isCorrect() {
if (!currentPipelineItem?.validationOptions) {
Expand Down Expand Up @@ -164,12 +177,12 @@ export function AnswerValidator(
},

isEqualToRowOption(rowIndex: number, optionValue: string) {
const selectedOption = getRowOptionValues(rowIndex);
const selectedOption = getSelectionRowOptionValue(rowIndex);
return selectedOption !== null && selectedOption.includes(optionValue);
},

isNotEqualToRowOption(rowIndex: number, optionValue: string) {
const selectedOption = getRowOptionValues(rowIndex);
const selectedOption = getSelectionRowOptionValue(rowIndex);
return selectedOption !== null && !selectedOption.includes(optionValue);
},

Expand Down

0 comments on commit ed9e49f

Please sign in to comment.