DailyReportBuilder
enum DailyReportBuilder
Builds the data for a daily report and prefills its text. The text it writes is a starting point: people edit all of it.
-
The sections nobody but a person can fill in. Regeneration never touches these.
Declaration
Swift
static let freeFormSections: [String]
-
defaultWindow(now:Asynchronouson: ) The default reporting window: the 24 hours ending at the most recent occurrence of the configured cutoff time (5PM unless
Settings.dailyReportEndHour/dailyReportEndMinutesay otherwise), ship time.Declaration
Swift
static func defaultWindow(now: Date = Date(), on db: Database) async throws -> (start: Date, end: Date) -
The default report title: the weekday the period ends on, in ship time (e.g. “Monday”). A 5PM-to-5PM period is “Monday’s report”.
Declaration
Swift
static func defaultTitle(forWindowEnd end: Date) -> String -
A readable reporting period with weekdays, in ship time: “Mon 3/21/26, 5:00 PM - Tue 3/22/26, 5:00 PM PDT”. If the period spans a time zone change, each end shows its own zone.
See moreDeclaration
Swift
static func windowText(start: Date, end: Date) -> String -
Which day of the cruise (1 = embarkation day) a moment falls on, or nil if it’s outside the cruise.
Declaration
Swift
static func cruiseDay(for date: Date) -> Int?
-
collect(start:Asynchronousend: on: ) Measures the window
[start, end).Declaration
Swift
static func collect(start: Date, end: Date, on req: Request) async throws -> DailyReportStats -
collectCommunitySupport(start:Asynchronousend: audit: on: ) Declaration
Swift
private static func collectCommunitySupport( start: Date, end: Date, audit: [AuditLogEntry], on req: Request ) async throws -> DailyReportStats.CommunitySupportStats
-
Fills the auto-drafted sections of
reportfromstats. Leaves the free-form sections (freeFormSections) alone.Declaration
Swift
static func prefill(_ report: DailyReport, from stats: DailyReportStats) -
Declaration
Swift
private static func timeString(_ date: Date) -> String
View on GitHub