DailyThemeScheduleSync
struct DailyThemeScheduleSync
Computes the differences between the DailyTheme table and the theme days found in the Event schedule.
Theme days in the schedule are events whose title begins with “Theme:” (e.g. “Theme: Cosplay Day”). The remainder of the title becomes the theme’s title and the event description becomes the theme’s info. Themes are matched to events by cruise day.
-
Themes that are in the schedule but have no
DailyThemefor that day.Declaration
Swift
var created: [DailyThemeProposedData] -
Existing
DailyThemes whose title or info differ from the schedule, paired with the schedule’s values.Declaration
Swift
var modified: [(theme: DailyTheme, proposed: DailyThemeProposedData)] -
Existing
DailyThemes for days that have no theme event in the schedule.Declaration
Swift
var deleted: [DailyTheme] -
Declaration
Swift
static let titlePrefix: String -
compute(cruiseDayOffset:Asynchronouson: ) Declaration
Swift
static func compute(cruiseDayOffset: Int = 0, on db: Database) async throws -> DailyThemeScheduleSyncParameters
cruiseDayOffsetAdded to each computed cruise day. Lets a schedule from outside the cruise week be loaded onto arbitrary days for testing.
-
Declaration
Swift
func differenceData() throws -> DailyThemeUpdateDifferenceData -
apply(skipNew:AsynchronousskipDiff: skipDelete: on: ) Applies the changes to the database. Deletes happen first, then modifications, then creates, so that the unique
cruise_dayconstraint is never violated by the sequence of operations.Declaration
Swift
func apply(skipNew: Bool, skipDiff: Bool, skipDelete: Bool, on db: Database) async throws
View on GitHub