Skip to content

Commit

Permalink
fix: remove childname in _id
Browse files Browse the repository at this point in the history
  • Loading branch information
KenLSM committed Dec 11, 2024
1 parent 518796b commit 4523b11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/app/modules/myinfo/myinfo.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ export const handleMyInfoChildHashResponse = (
// Validate each answer (child)
childAnswer.forEach((attrAnswer, subFieldIndex) => {
const key = getMyInfoChildHashKey(
field._id as string,
field._id,
subFields[subFieldIndex],
childIndex,
childName,
Expand Down
11 changes: 3 additions & 8 deletions src/app/modules/submission/submission.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,17 +752,12 @@ export const getAnswersForChild = (
return []
}
return response.answerArray.flatMap((arr, childIdx) => {
// First array element is always child name
const childName = arr[0]
return arr.map((answer, idx) => {
const subfield = subFields[idx]
return {
_id: getMyInfoChildHashKey(
response._id,
subFields[idx],
childIdx,
childName,
),
// Recreates the individual _id of the child field based on the parent field's _id and the subfield
// e.g., childrenbirthrecords.67585515e1ced6d790a91e14.childname.0
_id: `${MyInfoAttribute.ChildrenBirthRecords}.${response._id}.${subFields[idx]}.${childIdx}`,
fieldType: response.fieldType,
// qnChildIdx represents the index of the MyInfo field
// childIdx represents the index of the child in this MyInfo field
Expand Down

0 comments on commit 4523b11

Please sign in to comment.