my-sea spectator: render all present members on the hex (2C-6C), not just the viewer — TDD
The spectator hex showed only owner 1C + the viewer in 2C; other present visitors were invisible. The view now builds a list — owner 1C + each present invitee in 2C-6C by deposit order (capped at MY_SEA_MAX_VISITORS) — so every viewer sees the same absolute seating, with their own seat marked .table-seat--self (a subtle --terUser tint). - my_sea_visit: context (present/empty + token + label + is_self). - my_sea_visit.html: seat ring loops instead of a hardcoded 1C/2C. - _room.scss: .table-seat--self chair tint. - +1 IT (3 present visitors → 2C-4C seated, viewer is the --self one); the both-seated IT updated for the --self marker. 292 gameboard ITs green. Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -164,8 +164,9 @@ class MySeaVisitContextTest(TestCase):
|
||||
self.assertTrue(ctx["seat1_present"]) # owner drawn
|
||||
self.assertTrue(ctx["seat2_present"]) # visitor present
|
||||
html = self.client.get(self.url).content.decode()
|
||||
self.assertIn('class="table-seat seated" data-slot="1"', html)
|
||||
self.assertIn('class="table-seat seated" data-slot="2"', html)
|
||||
self.assertIn('class="table-seat seated" data-slot="1"', html) # owner
|
||||
# The viewer's own seat (2C) carries the --self marker.
|
||||
self.assertIn('table-seat--self" data-slot="2"', html)
|
||||
self.assertEqual(
|
||||
html.count('class="position-status-icon fa-solid fa-circle-check"'), 2)
|
||||
|
||||
@@ -335,6 +336,26 @@ class MySeaVisitCapacityTest(TestCase):
|
||||
reverse("my_sea_visit_gate", args=[self.owner.id])).context
|
||||
self.assertTrue(ctx["table_full"])
|
||||
|
||||
def test_other_present_visitors_render_in_3c_onward(self):
|
||||
# The viewer + 2 other present visitors → owner 1C, viewer 2C,
|
||||
# the two others 3C/4C; the viewer's seat is the --self one.
|
||||
viewer, vinv = self._accepted_invitee(0, present=True)
|
||||
self._accepted_invitee(1, present=True)
|
||||
self._accepted_invitee(2, present=True)
|
||||
self.client.force_login(viewer)
|
||||
resp = self.client.get(reverse("my_sea_visit", args=[self.owner.id]))
|
||||
seats = resp.context["seats"]
|
||||
# Owner has no draw here (1C empty); 3 present visitors fill 2C–4C.
|
||||
self.assertEqual(sum(1 for s in seats if s["present"]), 3)
|
||||
# Visitors fill 2C, 3C, 4C; exactly one is the viewer (is_self).
|
||||
selves = [s for s in seats if s.get("is_self")]
|
||||
self.assertEqual(len(selves), 1)
|
||||
html = resp.content.decode()
|
||||
self.assertIn('data-slot="3"', html)
|
||||
self.assertIn("table-seat--self", html)
|
||||
# Owner isn't seated (no draw) in this fixture → 1C is the empty seat.
|
||||
self.assertFalse(seats[0]["present"])
|
||||
|
||||
def test_already_present_visitor_is_not_blocked_by_a_full_table(self):
|
||||
# The 5th present visitor re-POSTing insert is a no-op (already seated),
|
||||
# never a "full" bounce.
|
||||
|
||||
Reference in New Issue
Block a user