Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 8 additions & 5 deletions backend/src/routes/doctorOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,12 @@ router.post('/api/addRx', async (req, res) => {
*/
router.patch('/api/updateRx/:id', async (req, res) => {
try {
const dontUpdateStatusBool = req.query.dontUpdateStatus;
// Finding by id
const order = await doctorOrder.findById(req.params.id).exec();
console.log('found by id!');

console.log('order', order);
if (order.dispenseStatus === 'Picked Up') {
console.log('Do not update prescription if it is picked up, it was verified before');
return;
}

// Reaching out to REMS Admin finding by pt name and drug name
// '/etasu/met/patient/:patientFirstName/:patientLastName/:patientDOB/drug/:drugName',
Expand All @@ -87,7 +84,13 @@ router.patch('/api/updateRx/:id', async (req, res) => {
// Saving and updating
const newOrder = await doctorOrder.findOneAndUpdate(
{ _id: req.params.id },
{ dispenseStatus: response.data.status, metRequirements: response.data.metRequirements },
{
dispenseStatus:
dontUpdateStatusBool || order.dispenseStatus === 'Picked Up'
? order.dispenseStatus
: response.data.status,
metRequirements: response.data.metRequirements
},
{
new: true
}
Expand Down
1 change: 0 additions & 1 deletion frontend/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"type" :"number",
"default" : 5050
},

"SSL_KEY_FILE": {
"type": "string",
"default": "server.key"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const EtasuPopUp = (props: any) => {
const handleClickOpen = () => {
setOpen(true);
// call api endpoint to update
const url = '/doctorOrders/api/updateRx/' + props.data._id;
const url = '/doctorOrders/api/updateRx/' + props.data._id + '?dontUpdateStatus=true';
axios.patch(url)
.then(function (response) {
const DoctorOrders = response.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const PickedUpButton = (props: any) => {
};

return (
<Button variant="contained" size="small" onClick={verifyOrder}>Mark as Picked</Button>
<Button variant="contained" size="small" onClick={verifyOrder}>Mark as Picked Up</Button>
);
};

Expand Down