dreamteamprod / dreamteamprod/DigiScript

Add session-aware mic allocation re-run from casting diff

Open
#1,114 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

claude
Dominant language
Vue
Stars
19
Forks
4
Avg merge
2d 12h
Merged PRs (30d)
37

Description

Summary

When an understudy or cover is playing a role for a given session, the existing mic auto-assignment should be re-run with the actual performers for that night. This adds a cast diff view to the Mics page, per-row apply/skip controls, a preview timeline, and a re-run modal with "preserve overrides" vs "wipe and regenerate" options.

Part 3 of 3 for issue #792. Depends on #1113 (casting matrix must exist).


Backend changes

Update MicrophoneAutoAssignmentController (controllers/api/show/microphones.py, POST /show/microphones/suggest):

  • Accept optional casting_overrides: {character_id: cast_id} in body — the algorithm uses these instead of Character.played_by for the affected characters' swap-cost calculations (same actor = zero swap cost)
  • Accept preserve_overrides: bool (default true) — when false, existing manual allocations are not treated as locked slots (wipe mode)

Update utils/show/mic_assignment.py (minimal change):

  • Add optional cast_overrides: dict[int, int] parameter to the assignment function
  • Where cast identity is looked up via character.played_by, check the overrides dict first

Frontend changes (client-v3/)

ConfigMics.vue — new re-run section:

  • When castDiffForSession getter (from #1113) is non-empty: show amber "X cast changes pending — mic re-run recommended" badge in the page header
  • Add CastDiffTable.vue section below existing tabs that auto-expands when there are pending changes

New CastDiffTable.vue (components/show/config/mics/):

  • Header: "Pending Changes: {N}/{total}" with Select All / Clear
  • Columns: checkbox | Mic# | Act · Scene | Character | Was (struck-through) | Now (bold) | Apply/Skip toggle
  • Per-slot diff derived from current MicrophoneAllocation vs session casting
  • Live preview via existing MicTimeline component (updates as checkboxes change)
  • Footer: "{N} manual override(s) on file · Re-run with {checked} changes…" button (disabled if 0 checked)

New ReRunMicModal.vue (components/show/config/mics/):

  • Two radio options:
    • Preserve manual overrides (default/recommended)
    • Wipe and regenerate from scratch (destructive)
  • Lists current manual overrides
  • On confirm: POST /api/v1/show/microphones/suggest with {casting_overrides, preserve_overrides}PATCH /api/v1/show/microphones/allocations → success toast + badge clears

MicPlanStaleBanner.vue (full version, replacing stub from #1113):

  • Shows exact slot count: "2 cast changes · 5 mic slots affected"

StartSessionConfirmModal.vue (from #1112/#1113) — full stale-mic blocking:

  • If micPlanIsStaleForSession → amber warning: "Mic plan is out of date"; Start button disabled; "Go to Mics" link

stores/show.ts additions:

  • Getter: micPlanIsStaleForSession(sessionId): boolean
  • Action: reRunMicAllocation({sessionId, castingOverrides, preserveOverrides})

E2E tests

Update client-v3/e2e/tests/09-show-config-mics.spec.ts:

  • After cover casting change (from spec 12b), navigate to Mics
  • "Pending Cast Changes" section visible with diff rows
  • Uncheck one row → preview timeline updates
  • "Re-run…" → select Preserve → confirm → toast + badge clears

Update client-v3/e2e/tests/13-live-show.spec.ts:

  • Start session with cover cast → confirmation modal shows stale-mic warning + Start disabled
  • Navigate to Mics, re-run → return → Start now enabled

Verification

  • pytest — mic assignment tests with casting_overrides; existing allocation tests unchanged
  • npm run typecheck + npm run lint
  • npm run test:e2e — full suite

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with issue #1113 and the existing microphone assignment flow in controllers/api/show/microphones.py and utils/show/mic_assignment.py. Then inspect client-v3/ components, stores/show.ts, and the two named E2E specs to understand the casting diff, modal, stale-plan flow, and current tests. Done means the backend accepts the overrides, the Mics UI can preview and re-run selected changes, stale sessions are blocked, and the listed verification commands pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
api, full-stack, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.