mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 04:32:42 +00:00
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:
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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user