Tray follows the ?seat-selected seat, not the canonical PC seat

A multi-seat (CARTE) gamer clicking a pos-circle switched the sig overlay
(via the ?seat=N override) but the tray stayed pinned to the role-canonical
PC seat — my_tray_role read assigned_seats[0] (role-sorted, always PC) and
my_tray_sig read _canonical_user_seat. So every circle put the PC icon in
the tray regardless of which one was clicked.

Re-point both tray keys to the seat occupying current_slot (the acting
seat). Single-seat gamers are unaffected — their lone slot IS current_slot,
so selected_seat == their canonical seat.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-06-04 15:00:25 -04:00
parent 8c5d77d696
commit 4c484cf25a
2 changed files with 89 additions and 2 deletions

View File

@@ -458,7 +458,16 @@ def _role_select_context(room, user, seat_param=None):
if _turn is not None and _turn.slot_number == _seat_n
else "ineligible"
)
_my_role = assigned_seats[0].role if assigned_seats else None
# The tray mirrors the seat the viewer is ACTING AS — the seat occupying
# current_slot (the ?seat-selected pos-circle, else their lowest owned) —
# NOT the role-canonical PC seat. So a multi-seat (CARTE) gamer's tray
# follows whichever circle they switched to. A single-seat gamer's lone
# slot IS current_slot, so selected_seat == their canonical seat (no-op).
selected_seat = (
room.table_seats.filter(gamer=user, slot_number=current_slot).first()
if user.is_authenticated and current_slot is not None else None
)
_my_role = selected_seat.role if selected_seat else None
# `equipped_deck_id` gates the JS role-select guard (role-select.js L165).
# Falls back to ANY of the user's seats in this room w. deck_variant set
# — covers the CARTE multi-seat return path where the first role-pick
@@ -517,7 +526,10 @@ def _role_select_context(room, user, seat_param=None):
# Tray cell 2: sig card (set once polarity group confirms)
_canonical_seat = _canonical_user_seat(room, user) if user.is_authenticated else None
ctx["my_tray_sig"] = _canonical_seat.significator if _canonical_seat else None
# Sig cell follows the acting seat too (see selected_seat above), so a CARTE
# gamer sees the sig of the circle they switched to. SKY_SELECT overrides
# this below from the confirmed Character.
ctx["my_tray_sig"] = selected_seat.significator if selected_seat else None
if room.table_status == Room.SIG_SELECT:
user_seat = _canonical_user_seat(room, user) if user.is_authenticated else None