- Added `bidding_duration` field to `DraftSessionSettings` model and migration. - Updated `DraftStateManager` to manage bidding start/end times using session settings. - Extended WebSocket payloads to include bidding timer data. - Added `DraftCountdownClock` React component and integrated into admin and participant UIs. - Created new `DraftDebug` view, template, and front-end component for real-time state debugging. - Updated utility functions to handle new timer fields in draft state. - Changed script tags in templates to load with `defer` for non-blocking execution.
34 lines
1.4 KiB
Python
34 lines
1.4 KiB
Python
from django.shortcuts import render, get_object_or_404
|
|
from boxofficefantasy.models import League, Season
|
|
from draft.models import DraftSession
|
|
from boxofficefantasy.views import parse_season_slug
|
|
from django.contrib.auth.decorators import login_required
|
|
from boxofficefantasy_project.utils import decode_id
|
|
|
|
@login_required(login_url='/login/')
|
|
def draft_room(request, league_slug=None, season_slug=None, draft_session_id_hashed=None, subpage=""):
|
|
if draft_session_id_hashed:
|
|
draft_session_id = decode_id(draft_session_id_hashed)
|
|
draft_session = get_object_or_404(DraftSession, id=draft_session_id)
|
|
league = draft_session.season.league
|
|
season = draft_session.season
|
|
elif league_slug and season_slug:
|
|
raise NotImplementedError
|
|
league = get_object_or_404(League, slug=league_slug)
|
|
label, year = parse_season_slug(season_slug)
|
|
season = get_object_or_404(Season, league=league, label__iexact=label, year=year)
|
|
draft_session = get_object_or_404(DraftSession, season=season)
|
|
|
|
context = {
|
|
"draft_id_hashed": draft_session.hashid,
|
|
"league": league,
|
|
"season": season,
|
|
}
|
|
|
|
if subpage == "admin":
|
|
return render(request, "draft/room_admin.dj.html", context)
|
|
elif subpage == "debug":
|
|
return render(request, "draft/room_debug.dj.html", context)
|
|
else:
|
|
return render(request, "draft/room.dj.html", context)
|