Skip to content

Commit

Permalink
Issue #PS-000 feat: Fixed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
itsvick committed Aug 2, 2024
1 parent 4d072a0 commit 9073788
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/pages/learner/[userId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const LearnerProfile: React.FC = () => {
// find Address
const getFieldValue = (data: any, label: string) => {
const field = data.find((item: any) => item.label === label);
return field ? field.value[0] : null;
return field ? field?.value[0] : null;
};

// ger user information
Expand Down Expand Up @@ -444,14 +444,14 @@ const LearnerProfile: React.FC = () => {
displayValue:
selectedOption !== '-'
? selectedOption.label
: field.value
? toPascalCase(field.value)
: field?.value
? toPascalCase(field?.value)
: '-',
};
}
return {
...field,
displayValue: field.value ? toPascalCase(field.value) : '-',
displayValue: field?.value ? toPascalCase(field?.value) : '-',
};
});

Expand All @@ -463,15 +463,15 @@ const LearnerProfile: React.FC = () => {
//------ Test Report API Integration------

const handleChangeTest = (event: SelectChangeEvent) => {
const test = event.target.value;
const test = event?.target?.value;
setTest(test);
ReactGA.event('pre-post-test-selected', { testTypeSelected: test });
getDoIdForAssesmentReport(test, subject);
};

const handleChangeSubject = (event: SelectChangeEvent) => {
const subject = event.target.value;
setSubject(event.target.value);
const subject = event?.target?.value;
setSubject(event?.target?.value);
ReactGA.event('select-subject-learner-details-page', {
subjectSelected: subject,
});
Expand Down
20 changes: 10 additions & 10 deletions src/pages/user-profile/[userId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,25 @@ const TeacherProfile = () => {
}
if (item?.isMultiSelect) {
if (data[item.name] && item?.maxSelections > 1) {
if (field.value) {
if (field?.value) {
return [field.value];
}
return null;
} else if (item?.type === 'checkbox') {
if (field.value) {
if (field?.value) {
return String(field.value).split(',');
}
return null;
} else {
return field.value;
return field?.value;
}
} else {
if (item?.type === 'numeric') {
return parseInt(String(field.value));
return parseInt(String(field?.value));
} else if (item?.type === 'text') {
return String(field.value);
return String(field?.value);
} else {
return field.value;
return field?.value;
}
}
};
Expand Down Expand Up @@ -193,7 +193,7 @@ const TeacherProfile = () => {
// find Address
const getFieldValue = (data: any, label: string) => {
const field = data.find((item: any) => item.label === label);
return field ? field.value[0] : null;
return field ? field?.value[0] : null;
};

const { data, error, isLoading } = useProfileInfo(userId ?? '', true, reload);
Expand Down Expand Up @@ -310,7 +310,7 @@ const TeacherProfile = () => {
// Function to get label for a subject from the options array
const getLabelForSubject = (subject: string) => {
const option = teachSubjectsField?.options?.find(
(opt: any) => opt.value === subject
(opt: any) => opt?.value === subject
);
return option ? option.label : subject;
};
Expand Down Expand Up @@ -676,7 +676,7 @@ const TeacherProfile = () => {
color={theme.palette.warning.A200}
sx={{ wordBreak: 'break-word' }}
>
{item.value ? toPascalCase(item?.value) : '-'}
{item?.value ? toPascalCase(item?.value) : '-'}
</Typography>
</Grid>
);
Expand All @@ -702,7 +702,7 @@ const TeacherProfile = () => {
color={theme.palette.warning.A200}
sx={{ wordBreak: 'break-word' }}
>
{item.value
{item?.value
? toPascalCase(
getLabelForValue(item, item?.value)
)
Expand Down

0 comments on commit 9073788

Please sign in to comment.