Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) Program enrollment && regimen history not loading #493

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const ProgramEnrollment: React.FC<ProgramEnrollmentProps> = ({ enrollments = [],
id: `${enrollment.enrollmentUuid}`,
...enrollment,
...firstEncounter,
changeReasons: enrollment?.firstEncounter?.changeReasons?.join(', '),
changeReasons: Array.isArray(firstEncounter?.changeReasons) ? firstEncounter.changeReasons.join(', ') : '',
Copy link
Contributor

@ojwanganto ojwanganto Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the endpoint provide? We may also want to fix the backend if that can help

enrollmentEncounterUuid: enrollmentEncounterUuid,
};
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,26 @@ const RegimenHistory: React.FC<RegimenHistoryProps> = ({ patientUuid, category }

if (regimen?.length) {
const structuredListBodyRowGenerator = () => {
return regimen.map((regimen, i) => (
<StructuredListRow key={`row-${i}`} className={styles.structuredList}>
<StructuredListCell>{formatDate(parseDate(regimen.startDate), { mode: 'wide' })}</StructuredListCell>
<StructuredListCell>
{regimen.endDate ? formatDate(parseDate(regimen.endDate), { mode: 'wide' }) : ''}
</StructuredListCell>
<StructuredListCell>{regimen.regimenShortDisplay ? regimen.regimenShortDisplay : '——'}</StructuredListCell>
<StructuredListCell>{regimen.regimenLine ? regimen.regimenLine : '——'}</StructuredListCell>
<StructuredListCell>{regimen.changeReasons ? regimen.changeReasons.slice(1, -1) : '——'}</StructuredListCell>
<StructuredListCell></StructuredListCell>
</StructuredListRow>
));
return regimen
.filter((regimen) => regimen?.startDate)
.map((regimen, i) => (
<StructuredListRow key={`row-${i}`} className={styles.structuredList}>
<StructuredListCell>
{regimen?.startDate ? formatDate(parseDate(regimen?.startDate), { mode: 'wide' }) : ''}
</StructuredListCell>
<StructuredListCell>
{regimen?.endDate ? formatDate(parseDate(regimen?.endDate), { mode: 'wide' }) : ''}
</StructuredListCell>
<StructuredListCell>
{regimen?.regimenShortDisplay ? regimen?.regimenShortDisplay : '——'}
</StructuredListCell>
<StructuredListCell>{regimen?.regimenLine ? regimen?.regimenLine : '——'}</StructuredListCell>
<StructuredListCell>
{regimen?.changeReasons ? regimen?.changeReasons.slice(1, -1) : '——'}
</StructuredListCell>
<StructuredListCell></StructuredListCell>
</StructuredListRow>
));
};

return (
Expand Down