Skip to content

Commit 9090dfc

Browse files
committed
Correct the check - logic was backwards
1 parent c44f2ef commit 9090dfc

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

packages/updatePrescriptionStatus/src/utils/sqsClient.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,9 @@ export async function pushPrescriptionToNotificationSQS(
233233
// we don't want items that have gone from "ready to collect" to "ready to collect"
234234
// So chuck those out.
235235
const changedStatus = candidates
236-
// In this check, don't consider previous updates that have a defined PostDatedLastModifiedSetAt
237-
// This is because if the last one was post-dated, and the current one ISN'T, we DO want to send a notification
238-
.filter(item => item.previous?.PostDatedLastModifiedSetAt === undefined)
239236
.filter(({current, previous}) => {
240237
if (!previous) return true // no previous item (or hit an error getting one) -> treat as changed
238+
if (previous.PostDatedLastModifiedSetAt) return true // previous was post-dated -> treat as changed
241239
return norm(current.Status) !== norm(previous.Status)
242240
})
243241
.map(({current}) => current)

0 commit comments

Comments
 (0)