Skip to content

Commit

Permalink
Make it so 3c Part 5 Question 2 No doesnt crash page
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsummers1 committed Sep 18, 2024
1 parent bb0ac13 commit ecc419c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions services/ui-src/src/components/fields/Integer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ const getPrevYearValue = (question, lastYearFormData) => {

// Get questions from last years JSON
const questions =
lastYearFormData[3].contents.section.subsections[2].parts[partIndex]
lastYearFormData?.[3]?.contents.section.subsections[2].parts[partIndex]
.questions;

// Filter down to this question
const matchingQuestion = questions.filter(
const matchingQuestion = questions?.filter(
(question) => fieldsetId === question?.fieldset_info?.id
);

// The first will always be correct
if (matchingQuestion[0]) {
if (matchingQuestion?.[0]) {
prevYearValue = matchingQuestion[0].questions[0].answer?.entry;
}
}
Expand Down

0 comments on commit ecc419c

Please sign in to comment.