My Sign: Brief banner + Earthman [Shabby Cardstock] backup deck when no equipped — TDD
User-reported gap on /billboard/my-sign/ — admin user's only deck was in-use as `TableSeat.deck_variant` in another room (Wonderbeard) → `equipped_deck` cleared → previous my-sign template showed "Equip a card deck first…" w. no actionable next step. User scoped fix: don't force equip, just nudge via a Brief banner "Look!—no deck is equipped. Navigate to the Game Kit to equip one (FYI) or (NVM) proceed with the Earthman [Shabby Cardstock] deck.", title "Default deck warning". NVM dismisses + picker proceeds against an Earthman card pile labeled in-copy as the temporary backup; FYI links to /gameboard/ (Game Kit equip). User-modified line text in template: "Paperboard" → "Cardstock" mid-session ; **helper fallback** (epic/models.py): `personal_sig_cards(user)` now falls back to `DeckVariant.objects.filter(slug='earthman').first()` when `user.equipped_deck` is None — same 16-or-18 card pile, just sourced from the canonical Earthman deck rather than the empty FK. No new DeckVariant row needed; "Shabby Cardstock" is purely UX framing (cards are the same TarotCard records the room sig-select uses). Preserves the existing helper signature so no callers had to change ; **view + template** (billboard/views.py + my_sign.html): view passes `no_equipped_deck` + `show_backup_intro_banner` flags. Template removes the old `{% if not equipped_deck %}` forced-equip branch — picker now renders unconditionally w. cards from the backup helper when no deck is equipped. Brief banner fires via `Brief.showBanner({...})` on DOMContentLoaded when `show_backup_intro_banner` is true — gets h2-overlay positioning + NVM behavior + portal styling for free (per [[sprint-baltimorean-note-unlock-may18]] portrait h2 measurement in note.js's `_alignToH2`). Added `<script src="note.js">` to my_sign.html since the page didn't load it before. Post-render JS tags the Brief w. a `.my-sign-intro-banner` class so FTs (and any future my-sign-specific styling) can distinguish this nudge from other Briefs on the page ; **TDD trail** — 4 new FTs in `MySignBackupDeckTest` (test_bill_my_sign.py): T1 banner renders w. "Default deck warning" title + "no deck is equipped" + "Shabby Cardstock" copy + both action btns visible; T2 picker still populates 16 cards from backup; T3 NVM click removes the banner from the DOM; T4 FYI href ends w. /gameboard/. Initial reds (`NoSuchElementException` on all 4) confirmed before implementation. Plus 1 new IT in `PersonalSigCardsTest` pinning the helper fallback (16 cards w. all `c.deck_variant.slug == "earthman"`) ; pre-existing change picked up: `static_src/scss/rootvars.scss` (user-modified mid-session) ; 1020 IT/UT green; 7 FTs green (3 picker happy-path + 4 backup deck) in 56s. Sprint 4a-follow complete — primary deferral from Sprint 4a (deck-source fallback UX) now landed. Unblocks Sprint 4b (My Sea gating w. --terUser link to /billboard/my-sign/ when no sig set)
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:
@@ -268,14 +268,21 @@ def doff_title(request, slug):
|
||||
def my_sign(request):
|
||||
"""Render the picker — same 18-card pile as room sig-select (16 middle
|
||||
arcana courts + Major 0 & 1), pulled from the user's equipped deck.
|
||||
Polarity is determined post-hoc by the FLIP btn (significator_reversed)."""
|
||||
Polarity is determined post-hoc by the FLIP btn (significator_reversed).
|
||||
|
||||
Backup-deck branch: if the user has no equipped_deck AND no saved sig,
|
||||
`personal_sig_cards` falls back to the Earthman pile and the template
|
||||
renders an intro Brief banner labeling the backup as "Earthman [Shabby
|
||||
Paperboard]" with FYI (→ Game Kit) + NVM (dismiss + proceed) actions."""
|
||||
from apps.epic.models import personal_sig_cards
|
||||
deck = request.user.equipped_deck
|
||||
cards = personal_sig_cards(request.user) if deck else []
|
||||
cards = personal_sig_cards(request.user)
|
||||
no_equipped_deck = request.user.equipped_deck is None
|
||||
sig = request.user.significator
|
||||
return render(request, "apps/billboard/my_sign.html", {
|
||||
"cards": cards,
|
||||
"equipped_deck": deck,
|
||||
"current_significator": request.user.significator,
|
||||
"no_equipped_deck": no_equipped_deck,
|
||||
"show_backup_intro_banner": no_equipped_deck and sig is None,
|
||||
"current_significator": sig,
|
||||
"current_significator_reversed": request.user.significator_reversed,
|
||||
"page_class": "page-billboard page-my-sign",
|
||||
})
|
||||
|
||||
@@ -529,12 +529,18 @@ def _sig_unique_cards(room):
|
||||
|
||||
def personal_sig_cards(user):
|
||||
"""Solo equivalent of levity_sig_cards / gravity_sig_cards — uses
|
||||
User.equipped_deck instead of room.deck_variant. For the My Sig picker
|
||||
at /billboard/my-sig/. Same 18-card pile (16 middle arcana + Major 0 + 1),
|
||||
filtered by the user's Note unlocks (Schizo/Nomad lines)."""
|
||||
return _filter_major_unlocks(
|
||||
_sig_unique_cards_for_deck(user.equipped_deck), user,
|
||||
)
|
||||
User.equipped_deck instead of room.deck_variant. For the Game Sign
|
||||
picker at /billboard/my-sign/. Same 18-card pile (16 middle arcana +
|
||||
Major 0 + 1), filtered by the user's Note unlocks (Schizo/Nomad lines).
|
||||
|
||||
Fallback: if the user has no equipped_deck (e.g. their only deck is
|
||||
in-use as a TableSeat.deck_variant in an active room), fall back to
|
||||
the Earthman deck. The picker UI labels this "Earthman [Shabby
|
||||
Paperboard]" via a Brief banner — the cards are identical, the deck
|
||||
identity is just a UX framing for "temporary, doesn't belong to your
|
||||
Game Kit inventory"."""
|
||||
deck = user.equipped_deck or DeckVariant.objects.filter(slug="earthman").first()
|
||||
return _filter_major_unlocks(_sig_unique_cards_for_deck(deck), user)
|
||||
|
||||
|
||||
def _filter_major_unlocks(cards, user):
|
||||
|
||||
@@ -516,12 +516,20 @@ class PersonalSigCardsTest(TestCase):
|
||||
cards = personal_sig_cards(user)
|
||||
self.assertEqual(len(cards), 16)
|
||||
|
||||
def test_empty_when_user_has_no_equipped_deck(self):
|
||||
def test_falls_back_to_earthman_when_no_equipped_deck(self):
|
||||
"""Sprint 4a-follow contract: instead of returning an empty pile when
|
||||
the user has no equipped_deck (e.g. their deck is in-use as a
|
||||
TableSeat.deck_variant in an active room), personal_sig_cards falls
|
||||
back to the Earthman deck. The picker labels this "Earthman [Shabby
|
||||
Paperboard]" via a Brief banner at the view layer."""
|
||||
from apps.epic.models import personal_sig_cards
|
||||
user = User.objects.create(email="dekless@test.io")
|
||||
user.equipped_deck = None
|
||||
user.save(update_fields=["equipped_deck"])
|
||||
self.assertEqual(personal_sig_cards(user), [])
|
||||
cards = personal_sig_cards(user)
|
||||
self.assertEqual(len(cards), 16)
|
||||
# All cards should belong to the Earthman deck (the fallback)
|
||||
self.assertTrue(all(c.deck_variant.slug == "earthman" for c in cards))
|
||||
|
||||
def test_schizo_note_unlocks_major_1(self):
|
||||
from apps.drama.models import Note
|
||||
|
||||
Reference in New Issue
Block a user