diff --git a/src/components/CohortFacilitatorList.tsx b/src/components/CohortFacilitatorList.tsx index 3b04b9dd..5906d647 100644 --- a/src/components/CohortFacilitatorList.tsx +++ b/src/components/CohortFacilitatorList.tsx @@ -57,22 +57,19 @@ const CohortLearnerList: React.FC<CohortLearnerListProp> = ({ const resp = response?.result?.userDetails; if (resp) { - const userDetails = resp.map((user: any) => ({ - name: toPascalCase(user.name), - userId: user.userId, - memberStatus: user.status, - statusReason: user.statusReason, - cohortMembershipId: user.cohortMembershipId, - enrollmentNumber: capitalizeEachWord( - getFieldValue( - user?.customField, - 'fieldname', - 'Enrollment Number', - 'fieldvalues', - '-' - ) - ), - })); + const userDetails = resp.map((user: any) => { + const ageField = user.customField.find((field: { label: string }) => field.label === "AGE"); + return { + name: toPascalCase(user?.name), + userId: user?.userId, + memberStatus: user?.status, + statusReason: user?.statusReason, + cohortMembershipId: user?.cohortMembershipId, + enrollmentNumber: user?.username, + age: ageField ? ageField.value : null, // Extract age for the specific user + }; + }); + console.log(`userDetails`, userDetails); setUserData(userDetails); } @@ -113,6 +110,7 @@ const CohortLearnerList: React.FC<CohortLearnerListProp> = ({ userId={data.userId} learnerName={data.name} enrollmentId={data.enrollmentNumber} + age={data.age} cohortMembershipId={data.cohortMembershipId} isDropout={data.memberStatus === Status.DROPOUT} statusReason={data.statusReason}