@peopl-health/nexus 6.7.0-dev.21505 → 6.7.0-dev.21506
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -84,10 +84,14 @@ async function doctorPingedRecently(review, physicianEmail, now) {
|
|
|
84
84
|
return others > 0;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
// One reminder per ring: a stat/asap case whose doctor already got its early reminder goes straight to the team stage.
|
|
88
|
+
const remindedSince = (review, ringAt) => (review.doctorAlerts ?? []).some((sent) => sent.kind === 'reminder'
|
|
89
|
+
&& (sent.transport || sent.possiblyDelivered) && timeOf(sent.sentAt) >= ringAt.getTime());
|
|
90
|
+
|
|
87
91
|
async function remindDoctor(review, { ringAt, dueAt, physicianEmail, level }, now) {
|
|
88
92
|
const taken = await caseTakenReason(review, ringAt, level);
|
|
89
93
|
const testPatient = !taken && (await teamAlertIdentity(review)).identity.testPatient;
|
|
90
|
-
const skippedReason = taken || (testPatient ? 'test_patient' : null);
|
|
94
|
+
const skippedReason = taken || (testPatient ? 'test_patient' : null) || (remindedSince(review, ringAt) ? 'already_reminded' : null);
|
|
91
95
|
if (!skippedReason && await doctorPingedRecently(review, physicianEmail, now)) return false;
|
|
92
96
|
if (!await claim(review, { stage: 'doctor', ringAt, dueAt, physicianEmail, skippedReason, sentAt: now })) return false;
|
|
93
97
|
if (skippedReason) return false;
|