Flag overnight blocks in the v2 schedule API

This commit is contained in:
NeilClack
2026-09-11 18:24:51 -05:00
parent 750a9286c9
commit 177b7bb13a
4 changed files with 55 additions and 15 deletions
+8 -2
View File
@@ -1,4 +1,4 @@
import { toHm } from '$lib/schedule-utils';
import { blockDuration, isOvernight, toHm } from '$lib/schedule-utils';
// Canonical solfeggio id <- Hz, mirroring the kiosk's `frequencyIdForHz()`
// map (radiantwave-rebuild src/audio/audio_downloader.cpp). v2 must emit these
@@ -147,6 +147,8 @@ export type V2ScheduleBlock = {
startMinutes: number;
endTime: string;
endMinutes: number;
overnight: boolean;
durationMinutes: number;
proclamationIds: string[];
};
@@ -156,7 +158,9 @@ export type V2Schedule = {
};
/** Build a schedule Block for the kiosk. Only the selected Proclamation IDs are
* returned; the kiosk fetches proclamation content separately. */
* returned; the kiosk fetches proclamation content separately. `overnight`
* marks a range that crosses midnight (end clock time before start), and
* `durationMinutes` counts the wrap as the next day. */
export function serializeScheduleBlock(
block: { id: string; startMinutes: number; endMinutes: number },
proclamationIds: string[]
@@ -167,6 +171,8 @@ export function serializeScheduleBlock(
startMinutes: block.startMinutes,
endTime: toHm(block.endMinutes),
endMinutes: block.endMinutes,
overnight: isOvernight(block),
durationMinutes: blockDuration(block),
proclamationIds
};
}