refactor(01-18): format occurrence identity changes

- apply repository formatting to reminder and scheduling updates
- preserve verified occurrence behavior without semantic changes
This commit is contained in:
Marc-André Bombeck committed 2026-07-29 14:36:21 +02:00
1 parent 23c738efac
commit 0ae9165aae
4 files changed
+8 -19

No files matched your search

@@ -458,8 +458,7 @@ export async function handleReminderCheck(
const minutesToEnd =
(phaseWindow.end.getTime() - nowMs) / 60_000;
const windowDuration =
(phaseWindow.end.getTime() -
phaseWindow.start.getTime()) /
(phaseWindow.end.getTime() - phaseWindow.start.getTime()) /
60_000;
const thresholds = resolvePhaseThresholds(
phaseConfig,
@@ -481,16 +480,12 @@ export async function handleReminderCheck(
.filter((candidate) => candidate !== null)
.sort(
(a, b) =>
b.slotScheduledFor.getTime() -
a.slotScheduledFor.getTime(),
b.slotScheduledFor.getTime() - a.slotScheduledFor.getTime(),
)[0];
if (!phaseCandidate) continue;
const {
slotScheduledFor,
minutesToEnd,
currentPhase,
} = phaseCandidate;
const { slotScheduledFor, minutesToEnd, currentPhase } =
phaseCandidate;
const slotInstant = slotScheduledFor.getTime();
if (liveEraStart !== null && slotInstant < liveEraStart) {
continue;
+2 -2
View File
@@ -225,8 +225,8 @@ export async function buildMedicationsList(
const displaySchedule =
display?.scheduleId === undefined
? null
: m.schedules.find((schedule) => schedule.id === display.scheduleId) ??
null;
: (m.schedules.find((schedule) => schedule.id === display.scheduleId) ??
null);
// A prior-day rolling occurrence can remain the one authoritative
// actionable dose while today's same HH:mm window has already passed.
// The client window reducer uses this count to decide whether a passed
+1 -4
View File
@@ -175,10 +175,7 @@ function computeNextDueCandidate(input: {
for (let step = 0; step < 64; step++) {
if (next === null) break;
if (!isResolved(next.at)) {
if (
earliest === null ||
next.at.getTime() < earliest.at.getTime()
) {
if (earliest === null || next.at.getTime() < earliest.at.getTime()) {
earliest = { at: next.at, scheduleId: canonical.id };
}
break;
+1 -4
View File
@@ -314,10 +314,7 @@ export function nextOccurrenceAfter(
// tail is still open. Flooring only to today created a gap where an
// unresolved weekly dose vanished on the morning after it was due.
const floor = new Date(
Math.min(
dayFloor.getTime(),
rollingDoseDayFloor(schedule, ctx),
),
Math.min(dayFloor.getTime(), rollingDoseDayFloor(schedule, ctx)),
);
const slots = expandRolling(schedule, ctx, floor, limit);
for (const s of slots) {