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:
@@ -38,6 +38,7 @@ class OrderContext:
|
||||
cart_items: list # list of {product_id, category_id (primary), category_ids, quantity, unit_price}
|
||||
active_price_group_ids: set # set of PriceGroup.id that are currently active
|
||||
user_tier: Optional[str] = None # 'bronze'|'silver'|'gold' — placeholder
|
||||
active_scene_ids: set = field(default_factory=set) # the scenes on now (services/scenes.py, 2026-11-21)
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -144,6 +145,11 @@ def _eval_condition(ctype: str, params: dict, ctx: OrderContext,
|
||||
passed = pgid in ctx.active_price_group_ids
|
||||
return passed, {"price_group_active": passed}
|
||||
|
||||
if ctype == "scene_active":
|
||||
# a scene is on (owner 2026-11-21): party mode, match night…
|
||||
passed = params.get("scene_id") in ctx.active_scene_ids
|
||||
return passed, {"scene_active": passed}
|
||||
|
||||
if ctype == "user_tier":
|
||||
passed = ctx.user_tier in params.get("tiers", [])
|
||||
return passed, {"user_tier": ctx.user_tier}
|
||||
@@ -236,6 +242,12 @@ def _price_group_is_active(pg, now: datetime) -> bool:
|
||||
return bool(pg.is_active)
|
||||
|
||||
|
||||
def build_active_scene_ids(db: Session, now: datetime) -> set:
|
||||
"""The scenes on at `now` (services/scenes.py), for the condition "a scene is on"."""
|
||||
from services.scenes import active_ids
|
||||
return active_ids(db, now)
|
||||
|
||||
|
||||
def build_active_price_group_ids(db: Session, now: datetime) -> set:
|
||||
"""Fetch all price groups once per request and return active IDs."""
|
||||
from models.pricing import PriceGroup
|
||||
|
||||
Reference in New Issue
Block a user