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:
2026-11-20 19:22:47 +02:00
co-authored by Claude Opus 5.5
parent abab158b7c
commit 60e6a16217
44 changed files with 1429 additions and 533 deletions
+6 -2
View File
@@ -227,6 +227,8 @@ def price_lines(db, lines: list[Line], order_type: str, existing_cart: list | No
from services.pricing import OrderContext, build_active_price_group_ids, resolve_price
now = utcnow()
active = build_active_price_group_ids(db, now)
from services.pricing import build_active_scene_ids
scenes = build_active_scene_ids(db, now)
channel = point or point_for(order_type)
cart = list(existing_cart or [])
out = []
@@ -236,7 +238,7 @@ def price_lines(db, lines: list[Line], order_type: str, existing_cart: list | No
raise _bad(n, "not_sold_here")
here = {"product_id": p.id, "category_id": p.primary_category_id, "category_ids": p.category_ids,
"quantity": line.quantity, "unit_price": p.base_price + line.extra}
ctx = OrderContext(channel=channel, now=now, cart_items=cart + [here], active_price_group_ids=active)
ctx = OrderContext(channel=channel, now=now, cart_items=cart + [here], active_price_group_ids=active, active_scene_ids=scenes)
unit, events = resolve_price(p, line.quantity, line.extra, ctx, db)
out.append((unit, events))
cart.append({**here, "unit_price": unit})
@@ -250,11 +252,13 @@ def unit_prices(db, products, point: str, now=None) -> list[float]:
from services.pricing import OrderContext, build_active_price_group_ids, resolve_price
now = now or utcnow()
active = build_active_price_group_ids(db, now)
from services.pricing import build_active_scene_ids
scenes = build_active_scene_ids(db, now)
out = []
for p in products:
here = {"product_id": p.id, "category_id": p.primary_category_id, "category_ids": p.category_ids,
"quantity": 1, "unit_price": p.base_price}
ctx = OrderContext(channel=point, now=now, cart_items=[here], active_price_group_ids=active)
ctx = OrderContext(channel=point, now=now, cart_items=[here], active_price_group_ids=active, active_scene_ids=scenes)
out.append(resolve_price(p, 1, 0.0, ctx, db)[0])
return out