updated .fa-ban icon to update via js & ws; changed taken_roles (or its cognates) everywhere to starter_roles, as 'taken' will be used in respect to roles thru-out entire game, not just this seat-determining phase of Role Select; patched up chosen cards not disappearing upon previous gamer choice, & a try,except that catches attempts to select one anyway w. a 409 & optimistic card rollback; new IT confirms this 409
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -26,9 +26,13 @@ def _notify_turn_changed(room_id):
|
||||
room_id=room_id, role__isnull=True
|
||||
).order_by("slot_number").first()
|
||||
active_slot = active_seat.slot_number if active_seat else None
|
||||
starter_roles = list(
|
||||
TableSeat.objects.filter(room_id=room_id, role__isnull=False)
|
||||
.values_list("role", flat=True)
|
||||
)
|
||||
async_to_sync(get_channel_layer().group_send)(
|
||||
f'room_{room_id}',
|
||||
{'type': 'turn_changed', 'active_slot': active_slot},
|
||||
{'type': 'turn_changed', 'active_slot': active_slot, 'starter_roles': starter_roles},
|
||||
)
|
||||
|
||||
|
||||
@@ -147,7 +151,7 @@ def _role_select_context(room, user):
|
||||
card_stack_state = "eligible"
|
||||
else:
|
||||
card_stack_state = "ineligible"
|
||||
taken_roles = list(
|
||||
starter_roles = list(
|
||||
room.table_seats.exclude(role__isnull=True).values_list("role", flat=True)
|
||||
)
|
||||
_action_order = {r: i for i, r in enumerate(["PC", "NC", "EC", "SC", "AC", "BC"])}
|
||||
@@ -161,7 +165,7 @@ def _role_select_context(room, user):
|
||||
active_slot = active_seat.slot_number if active_seat else None
|
||||
ctx = {
|
||||
"card_stack_state": card_stack_state,
|
||||
"taken_roles": taken_roles,
|
||||
"starter_roles": starter_roles,
|
||||
"assigned_seats": assigned_seats,
|
||||
"user_seat": user_seat,
|
||||
"user_slots": list(
|
||||
@@ -371,7 +375,7 @@ def select_role(request, room_id):
|
||||
if not role or role not in valid_roles:
|
||||
return redirect("epic:gatekeeper", room_id=room_id)
|
||||
if room.table_seats.filter(role=role).exists():
|
||||
return redirect("epic:gatekeeper", room_id=room_id)
|
||||
return HttpResponse(status=409)
|
||||
active_seat.role = role
|
||||
active_seat.save()
|
||||
if room.table_seats.filter(role__isnull=True).exists():
|
||||
@@ -380,6 +384,7 @@ def select_role(request, room_id):
|
||||
room.table_status = Room.SIG_SELECT
|
||||
room.save()
|
||||
_notify_roles_revealed(room_id)
|
||||
return HttpResponse(status=200)
|
||||
return redirect("epic:gatekeeper", room_id=room_id)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user