Skip to content

Commit

Permalink
fix has previous log update not being filled (#6951)
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad authored and Ashesh3 committed Jan 2, 2024
1 parent ca94351 commit 3664210
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,31 +138,34 @@ export const DailyRounds = (props: any) => {
const fetchRoundDetails = useCallback(
async (status: statusType) => {
setIsLoading(true);
const res = await dispatchAction(
getConsultationDailyRoundsDetails({ consultationId, id })
);

let formData: any = {};
let formData: any = initialData;
if (id) {
const res = await dispatchAction(
getConsultationDailyRoundsDetails({ consultationId, id })
);

if (!status.aborted) {
if (res?.data) {
const data = {
...res.data,
patient_category: res.data.patient_category
? PATIENT_CATEGORIES.find(
(i) => i.text === res.data.patient_category
)?.id ?? ""
: "",
rhythm:
(res.data.rhythm &&
RHYTHM_CHOICES.find((i) => i.text === res.data.rhythm)?.id) ||
"0",
admitted_to: res.data.admitted_to ? res.data.admitted_to : "Select",
};
formData = { ...formData, ...data };
if (!status.aborted) {
if (res?.data) {
const data = {
...res.data,
patient_category: res.data.patient_category
? PATIENT_CATEGORIES.find(
(i) => i.text === res.data.patient_category
)?.id ?? ""
: "",
rhythm:
(res.data.rhythm &&
RHYTHM_CHOICES.find((i) => i.text === res.data.rhythm)?.id) ||
"0",
admitted_to: res.data.admitted_to
? res.data.admitted_to
: "Select",
};
formData = { ...formData, ...data };
}
}
setIsLoading(false);
}
setIsLoading(false);
if (patientId) {
const res = await dispatchAction(getPatient({ id: patientId }));
if (res.data) {
Expand Down Expand Up @@ -214,9 +217,7 @@ export const DailyRounds = (props: any) => {
);
useAbortableEffect(
(status: statusType) => {
if (id) {
fetchRoundDetails(status);
}
fetchRoundDetails(status);
},
[dispatchAction, fetchRoundDetails]
);
Expand Down

0 comments on commit 3664210

Please sign in to comment.