-
Notifications
You must be signed in to change notification settings - Fork 430
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
Issues/7350/log update consistency #8278
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -13,6 +13,7 @@ const MENU_TAGS: { [key: string]: string } = { | |||
external_results: "External Results", | ||||
users: "Users", | ||||
notice_board: "Notice Board", | ||||
"daily-rounds": "Log Update", | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change the URL's path param itself instead
Suggested change
|
||||
}; | ||||
|
||||
const capitalize = (string: string) => { | ||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -113,7 +113,7 @@ let make = ( | |||||
<div> | ||||||
<div | ||||||
className="bg-white px-2 md:px-6 py-5 border-b border-secondary-200 sm:px-6 max-w-5xl mx-auto border mt-4 shadow rounded-lg"> | ||||||
<h1 className="text-4xl sm:text-5xl"> {str("Consultation Update")} </h1> | ||||||
<h1 className="text-4xl sm:text-5xl"> {str("Log Update")} </h1> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why wrap it in
Suggested change
|
||||||
<div> | ||||||
<CriticalCare__PageTitle title="General" /> | ||||||
<DailyRound__General others title renderOptionalDescription /> | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -350,7 +350,26 @@ export default function NotificationsList({ | |
}) | ||
.then((res) => { | ||
if (res && res.data) { | ||
setData(res.data.results); | ||
const toChangeId = [ | ||
"PATIENT_CONSULTATION_UPDATED", | ||
"PATIENT_CONSULTATION_UPDATE_CREATED", | ||
"PATIENT_CONSULTATION_UPDATE_UPDATED", | ||
"PATIENT_CONSULTATION_CREATED", | ||
]; | ||
const modifiedData = res.data.results.map((notification: any) => { | ||
if (toChangeId.includes(notification.event)) { | ||
return { | ||
...notification, | ||
message: notification.message.replace( | ||
"Consultation", | ||
"Log Updates", | ||
), | ||
}; | ||
} else { | ||
return notification; | ||
} | ||
Comment on lines
+354
to
+370
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem to be the right way to do it. Why is patient consultation created event being renamed to log update? Consultation creation is not relevant to log updates right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you clarify if the way I am modifying data is wrong or is it just the part that I have 'PATIENT_CONSULTATION_CREATED' in toChangeId wrong? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consultation Create notification message need not be replaced with log updates right? |
||
}); | ||
setData(modifiedData); | ||
setUnreadCount( | ||
res.data.results?.reduce( | ||
(acc: number, result: any) => acc + (result.read_at ? 0 : 1), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the right way to solve the problem.
It should instead be changed in the props passed to this component.
Reusable components such as these should not contain any implementation specific to a particular usage.