From 00dbe566b08bffc3180b6b613f2f293652195741 Mon Sep 17 00:00:00 2001 From: Arif Date: Tue, 3 Sep 2024 17:44:59 +0530 Subject: [PATCH] Issue #0000 chore: resolved build issue --- src/components/CohortFacilitatorList.tsx | 30 +++++++++++------------- 1 file changed, 14 insertions(+), 16 deletions(-) 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 = ({ 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 = ({ userId={data.userId} learnerName={data.name} enrollmentId={data.enrollmentNumber} + age={data.age} cohortMembershipId={data.cohortMembershipId} isDropout={data.memberStatus === Status.DROPOUT} statusReason={data.statusReason}