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:
@@ -41,5 +41,6 @@ import models.refund # noqa: F401 Refund, RefundItem (step 3.3e)
|
||||
import models.media # noqa: F401 Media (media library, step 5.1)
|
||||
import models.display_look # noqa: F401 DisplayLook (customer display looks, step 5.3)
|
||||
import models.signage # noqa: F401 SignagePlaylist, SignageSlide (signage, step 5.4a)
|
||||
import models.scene # noqa: F401 Scene (2026-11-21)
|
||||
import models.tablet_order # noqa: F401 TabletOrder (ordering from a menu tablet, step 6.6)
|
||||
import models.floor_plan # noqa: F401 FloorPlan, FloorItem (the table map, step 6.8)
|
||||
|
||||
@@ -91,6 +91,7 @@ class PriceModifierCondition(Base):
|
||||
min_order_value {"min": 0.00} (cart total before modifiers)
|
||||
order_channel {"channels": [sales point, ...]} (core/sales_points.py; phase 3S)
|
||||
price_group_active {"price_group_id": N}
|
||||
scene_active {"scene_id": N} (a scene is on: services/scenes.py, 2026-11-21)
|
||||
user_tier {"tiers": ["bronze","silver","gold"]} (placeholder, needs user accounts)
|
||||
low_stock {"threshold": N} (placeholder, needs inventory)
|
||||
"""
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"""Scenes (owner 2026-11-21): a named mode of the venue ("Party mode", "Match night") that is on or
|
||||
off. What follows a scene: signage schedule lines that play only while it is on (and win by their
|
||||
priority), and price rules / deals with the condition "a scene is on". Several can be on at once;
|
||||
one may turn itself off at a time (`until`). services/scenes.py.
|
||||
"""
|
||||
from sqlalchemy import Boolean, Column, Integer, String
|
||||
|
||||
from core.timeutil import UTCDateTime, utcnow
|
||||
from database import Base
|
||||
|
||||
|
||||
class Scene(Base):
|
||||
__tablename__ = "scenes"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String, nullable=False)
|
||||
color = Column(String, nullable=True) # "#rrggbb", the venue's choice
|
||||
description = Column(String, nullable=True)
|
||||
is_active = Column(Boolean, nullable=False, default=False)
|
||||
activated_at = Column(UTCDateTime, nullable=True)
|
||||
until = Column(UTCDateTime, nullable=True) # on until then (None: until turned off)
|
||||
sort_order = Column(Integer, nullable=False, default=0)
|
||||
created_at = Column(UTCDateTime, default=utcnow, nullable=False)
|
||||
@@ -6,8 +6,9 @@ a text, with its time on screen, its transition and when it may show (days, hour
|
||||
What the slide shows is `content`, typed per kind in routers/signage.py (pictures and videos
|
||||
as media library ids, which the library protects while used).
|
||||
|
||||
A paired signage screen plays the playlist in its device config (`playlist`), in its own
|
||||
orientation and rotation (modules/signage/manifest.py).
|
||||
A paired signage screen plays its default playlist (device config `playlist`) in its own
|
||||
orientation and rotation (modules/signage/manifest.py), unless a schedule line for it matches
|
||||
(SignageScheduleItem, 2026-11-21).
|
||||
"""
|
||||
from sqlalchemy import JSON, Boolean, Column, ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import relationship
|
||||
@@ -53,15 +54,27 @@ class SignageSlide(Base):
|
||||
playlist = relationship("SignagePlaylist", back_populates="slides")
|
||||
|
||||
|
||||
class SignageSchedule(Base):
|
||||
"""Which playlist plays when (5.4d): entries matched in venue time (services/signage_schedule.py),
|
||||
the fallback when none matches. A screen with a schedule plays it instead of a single playlist."""
|
||||
__tablename__ = "signage_schedules"
|
||||
class SignageScheduleItem(Base):
|
||||
"""A schedule line (owner 2026-11-21, was named schedules of 5.4d): a playlist on some screens
|
||||
(none picked = every screen), on some days / hours / dates / smart days (core/calendar_days.py),
|
||||
optionally only while a scene is on, with a priority. At a moment, a screen plays the line
|
||||
that matches with the highest priority (then the most specific, then the later one); none →
|
||||
its own default playlist (Screens). services/signage_schedule.py."""
|
||||
__tablename__ = "signage_schedule_items"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String, nullable=False)
|
||||
fallback_playlist_id = Column(Integer, ForeignKey("signage_playlists.id", ondelete="SET NULL"), nullable=True)
|
||||
# [{playlist_id, days, time_from, time_to, date_from, date_to, priority}]
|
||||
entries = Column(JSON, nullable=False, default=list)
|
||||
name = Column(String, nullable=True)
|
||||
playlist_id = Column(Integer, ForeignKey("signage_playlists.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
screen_ids = Column(JSON, nullable=False, default=list) # [] = every screen
|
||||
priority = Column(Integer, nullable=False, default=0)
|
||||
enabled = Column(Boolean, nullable=False, default=True)
|
||||
days = Column(JSON, nullable=False, default=list) # [0..6], Monday = 0; [] = every day
|
||||
month_days = Column(JSON, nullable=False, default=list) # smart days: first, last, first_week, last_week, holiday, not_holiday
|
||||
time_from = Column(String, nullable=True)
|
||||
time_to = Column(String, nullable=True)
|
||||
date_from = Column(String, nullable=True)
|
||||
date_to = Column(String, nullable=True)
|
||||
scene_id = Column(Integer, ForeignKey("scenes.id", ondelete="SET NULL"), nullable=True, index=True)
|
||||
position = Column(Integer, nullable=False, default=0)
|
||||
created_at = Column(UTCDateTime, default=utcnow, nullable=False)
|
||||
updated_at = Column(UTCDateTime, default=utcnow, onupdate=utcnow, nullable=False)
|
||||
|
||||
Reference in New Issue
Block a user