feat(signage,scenes): schedule lines with screens and smart days, screens' defaults, horizontal timeline, scenes
- Scenes (Alembic 0043, models/scene.py, /api/scenes, core.scenes.manage): named modes on or off (optionally until a time); price rules / deals get the condition "a scene is on"; signage lines can play only during a scene; turning one on tells every screen and pushes the online menu. - Signage schedules are lines (signage_schedule_items): playlist, screens ([] = every screen), priority, days, smart days (1st / last day, first / last week, Greek public holidays or not: core/calendar_days.py, mirrored in @xenia/signage), hours, dates, scene. No line → the screen's default playlist. 0043 turns the old named schedules into lines for their screens. - Screens: default playlist, TV shape, turn; what plays now and why. - Manager: tabs Screens · Playlists · Schedules · Slides (placeholder) · Message and weather; schedule lines with playlist / screens / priority / delete on one line; the playlist editor's horizontal timeline of fixed cards, the slide's basics beside its preview (one height), then its content; Management → Scenes; the scene condition in pricing. - Tests: backend (lines, smart days, scenes, prices), player logic, e2e. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -119,3 +119,20 @@ test('weather codes → icons', () => {
|
||||
assert.equal(weatherIcon(45), 'fog')
|
||||
assert.equal(weatherIcon(null), 'cloud')
|
||||
})
|
||||
|
||||
test('smart days and scenes, the same dates as the server (owner 2026-11-21)', async () => {
|
||||
const { isHoliday, matches, monthDaysOk, orthodoxEaster, pick } = await import('../src/logic.js')
|
||||
assert.deepEqual([2025, 2026, 2027].map(orthodoxEaster), ['2025-04-20', '2026-04-12', '2027-05-02'])
|
||||
assert.ok(isHoliday('2026-03-25') && isHoliday('2026-02-23') && isHoliday('2026-04-10') && isHoliday('2026-04-13'))
|
||||
assert.ok(isHoliday('2026-06-01') && !isHoliday('2026-06-02'))
|
||||
assert.ok(monthDaysOk(['first'], '2026-11-01') && !monthDaysOk(['first'], '2026-11-02'))
|
||||
assert.ok(monthDaysOk(['last'], '2026-02-28') && !monthDaysOk(['last'], '2026-02-27'))
|
||||
assert.ok(monthDaysOk(['first_week'], '2026-11-07') && !monthDaysOk(['first_week'], '2026-11-08'))
|
||||
assert.ok(monthDaysOk(['last_week'], '2026-11-24') && !monthDaysOk(['last_week'], '2026-11-23'))
|
||||
assert.ok(!monthDaysOk(['not_holiday'], '2026-12-25') && monthDaysOk(['not_holiday'], '2026-12-24'))
|
||||
const sat = { weekday: 5, minutes: 13 * 60, date: '2026-11-21' }
|
||||
const entries = [{ playlist_id: 40, date_from: '2026-11-21', date_to: '2026-11-21', priority: 5 }, { playlist_id: 50, scene_id: 1, priority: 9 }]
|
||||
assert.equal(pick(entries, 99, sat), 40)
|
||||
assert.equal(pick(entries, 99, sat, [1]), 50)
|
||||
assert.ok(!matches({ scene_id: 2 }, sat, [1]))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user