setup_sig_session: wire deck contributions; _room_deck_variant replaces owner.equipped_deck
- setup_sig_session: drop _ensure_earthman() (deck seeded by migration); set deck_variant=earthman on all TableSeats; users get unlocked_decks add but equipped_deck=None (seat owns the deck); docstring documents role-pair mapping - _room_deck_variant(room): new helper looks up deck from any seated deck_variant, falls back to owner.equipped_deck for legacy rooms - sig_deck_cards / _sig_unique_cards: use _room_deck_variant instead of owner.equipped_deck — sig cards now work even when users have unequipped their deck after role confirmation Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -421,6 +421,19 @@ class SigReservation(models.Model):
|
||||
|
||||
# ── Significator deck helpers ─────────────────────────────────────────────────
|
||||
|
||||
def _room_deck_variant(room):
|
||||
"""Return the DeckVariant in use for this room.
|
||||
|
||||
Looks up the deck committed to any TableSeat in the room (all seats share the
|
||||
same deck per game). Falls back to the room owner's equipped_deck for rooms
|
||||
created before deck contribution was wired.
|
||||
"""
|
||||
seat = room.table_seats.filter(deck_variant__isnull=False).first()
|
||||
if seat:
|
||||
return seat.deck_variant
|
||||
return room.owner.equipped_deck
|
||||
|
||||
|
||||
def sig_deck_cards(room):
|
||||
"""Return 36 TarotCard objects forming the Significator deck (18 unique × 2).
|
||||
|
||||
@@ -429,7 +442,7 @@ def sig_deck_cards(room):
|
||||
NC/EC pair → MAJOR arcana numbers 0 and 1: 2 unique
|
||||
Total: 18 unique × 2 (levity + gravity piles) = 36 cards.
|
||||
"""
|
||||
deck_variant = room.owner.equipped_deck
|
||||
deck_variant = _room_deck_variant(room)
|
||||
if deck_variant is None:
|
||||
return []
|
||||
wands_crowns = list(TarotCard.objects.filter(
|
||||
@@ -455,7 +468,7 @@ def sig_deck_cards(room):
|
||||
|
||||
def _sig_unique_cards(room):
|
||||
"""Return the 18 unique TarotCard objects that form one sig pile."""
|
||||
deck_variant = room.owner.equipped_deck
|
||||
deck_variant = _room_deck_variant(room)
|
||||
if deck_variant is None:
|
||||
return []
|
||||
wands_crowns = list(TarotCard.objects.filter(
|
||||
|
||||
Reference in New Issue
Block a user