fix: keep best-of-three grand finals open for results
Allow a separate grand final format and repair prematurely completed finals without dropping accepted games. Replay the correction record alongside subsequent results.
This commit is contained in:
1 parent
38a89b5374
commit
7e0cd7cb19
21 files changed
+914
-23
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
GrandFinalGameCount,
|
||||
MatchGameMode,
|
||||
MatchPosition,
|
||||
MatchPositionPreferenceView,
|
||||
@@ -282,6 +283,7 @@ export interface MatchMutationRequest {
|
||||
gameMode?: MatchGameMode;
|
||||
roundRobinMaxRounds?: number;
|
||||
doubleEliminationResetFinalEnabled?: boolean;
|
||||
doubleEliminationGrandFinalGameCount?: GrandFinalGameCount;
|
||||
prizes?: string[];
|
||||
notices?: string[];
|
||||
schedule?: MatchScheduleItemView[];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import type {
|
||||
GrandFinalGameCount,
|
||||
MatchDetailResponse,
|
||||
MatchGameMode,
|
||||
MatchLifecycleStatus,
|
||||
@@ -28,6 +29,7 @@ const DEFAULT_FORM: MatchMutationRequest = {
|
||||
gameCount: 3,
|
||||
gameMode: 'pair',
|
||||
doubleEliminationResetFinalEnabled: true,
|
||||
doubleEliminationGrandFinalGameCount: 3,
|
||||
prizes: [],
|
||||
notices: [],
|
||||
schedule: [],
|
||||
@@ -53,7 +55,9 @@ function matchModeDetail(match: MatchDetailResponse) {
|
||||
return `최대 ${match.roundRobinMaxRounds}라운드`;
|
||||
}
|
||||
if (match.gameMode === 'double-elimination') {
|
||||
return match.doubleEliminationResetFinalEnabled ? '결승 리셋 허용' : '결승 리셋 없음';
|
||||
const finalGames = match.doubleEliminationGrandFinalGameCount ?? 1;
|
||||
const finalFormat = finalGames === 1 ? '단판' : `${finalGames}전 ${Math.ceil(finalGames / 2)}선승`;
|
||||
return `결승 ${finalFormat} · 리셋 ${match.doubleEliminationResetFinalEnabled ? '허용' : '없음'}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +156,8 @@ function makeForm(match?: MatchDetailResponse): MatchMutationRequest & {
|
||||
roundRobinMaxRounds: match.roundRobinMaxRounds,
|
||||
doubleEliminationResetFinalEnabled:
|
||||
match.doubleEliminationResetFinalEnabled ?? true,
|
||||
doubleEliminationGrandFinalGameCount:
|
||||
match.doubleEliminationGrandFinalGameCount ?? 1,
|
||||
prizes: match.prizes,
|
||||
notices: match.notices,
|
||||
schedule: match.schedule,
|
||||
@@ -174,6 +180,7 @@ export default function MatchAdminPage() {
|
||||
const [editing, setEditing] = useState<MatchDetailResponse | null>(null);
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [form, setForm] = useState(makeForm());
|
||||
const isConfigLocked = editing !== null && editing.status !== 'recruiting';
|
||||
const [message, setMessage] = useState<string | null>(null);
|
||||
const formHeading = useRef<HTMLHeadingElement>(null);
|
||||
|
||||
@@ -216,11 +223,19 @@ export default function MatchAdminPage() {
|
||||
}
|
||||
|
||||
function buildPayload(): MatchMutationRequest {
|
||||
return {
|
||||
const details: MatchMutationRequest = {
|
||||
title: form.title.trim(),
|
||||
description: form.description?.trim() ?? '',
|
||||
mapId: Number(form.mapId ?? 11),
|
||||
scheduledAt: toIsoFromInput(form.scheduledAt),
|
||||
prizes: parseLines(form.prizesText),
|
||||
notices: parseLines(form.noticesText),
|
||||
schedule: parseSchedule(form.scheduleText),
|
||||
};
|
||||
if (isConfigLocked) return details;
|
||||
|
||||
return {
|
||||
...details,
|
||||
maxParticipants: Number(form.maxParticipants ?? 10),
|
||||
gameCount: Number(form.gameCount ?? 3),
|
||||
gameMode: form.gameMode,
|
||||
@@ -228,6 +243,10 @@ export default function MatchAdminPage() {
|
||||
form.gameMode === 'double-elimination'
|
||||
? Boolean(form.doubleEliminationResetFinalEnabled)
|
||||
: undefined,
|
||||
doubleEliminationGrandFinalGameCount:
|
||||
form.gameMode === 'double-elimination'
|
||||
? form.doubleEliminationGrandFinalGameCount
|
||||
: undefined,
|
||||
roundRobinMaxRounds:
|
||||
form.gameMode === 'round-robin'
|
||||
? normalizeRoundRobinMaxRounds(
|
||||
@@ -235,9 +254,6 @@ export default function MatchAdminPage() {
|
||||
form.maxParticipants,
|
||||
)
|
||||
: undefined,
|
||||
prizes: parseLines(form.prizesText),
|
||||
notices: parseLines(form.noticesText),
|
||||
schedule: parseSchedule(form.scheduleText),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -384,6 +400,7 @@ export default function MatchAdminPage() {
|
||||
<label className="text-xs text-base-content/45">
|
||||
정원
|
||||
<select
|
||||
disabled={isConfigLocked}
|
||||
value={form.maxParticipants}
|
||||
onChange={(event) => {
|
||||
const maxParticipants = Number(event.target.value);
|
||||
@@ -407,9 +424,10 @@ export default function MatchAdminPage() {
|
||||
</select>
|
||||
</label>
|
||||
<label className="text-xs text-base-content/45">
|
||||
게임 수
|
||||
{form.gameMode === 'double-elimination' ? '승자조 게임 수' : '게임 수'}
|
||||
<input
|
||||
type="number"
|
||||
disabled={isConfigLocked}
|
||||
min={1}
|
||||
step={form.gameMode === 'double-elimination' ? 2 : 1}
|
||||
value={form.gameCount}
|
||||
@@ -418,14 +436,14 @@ export default function MatchAdminPage() {
|
||||
/>
|
||||
{form.gameMode === 'double-elimination' && (
|
||||
<span className="mt-1 block text-xs text-base-content/30">
|
||||
승자조는 현재 3판 2선승으로 진행됩니다. 추후 5판 3선승도 같은
|
||||
구조로 지원합니다.
|
||||
승자조 시리즈에 적용됩니다. 패자조는 단판입니다.
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
<label className="text-xs text-base-content/45">
|
||||
게임 모드
|
||||
<select
|
||||
disabled={isConfigLocked}
|
||||
value={form.gameMode}
|
||||
onChange={(event) => {
|
||||
const gameMode = event.target.value as MatchGameMode;
|
||||
@@ -460,6 +478,7 @@ export default function MatchAdminPage() {
|
||||
<span className="ml-1 text-xs text-base-content/25">선택</span>
|
||||
<input
|
||||
type="number"
|
||||
disabled={isConfigLocked}
|
||||
min={1}
|
||||
max={roundRobinFullRoundCount || undefined}
|
||||
placeholder="예: 3"
|
||||
@@ -480,10 +499,31 @@ export default function MatchAdminPage() {
|
||||
</span>
|
||||
</label>
|
||||
)}
|
||||
{form.gameMode === 'double-elimination' && (
|
||||
<label className="text-xs text-base-content/45">
|
||||
그랜드 파이널 형식
|
||||
<select
|
||||
className="lts-select mt-1 w-full"
|
||||
disabled={isConfigLocked}
|
||||
value={form.doubleEliminationGrandFinalGameCount ?? 1}
|
||||
onChange={(event) =>
|
||||
setForm((current) => ({
|
||||
...current,
|
||||
doubleEliminationGrandFinalGameCount: Number(event.target.value) as GrandFinalGameCount,
|
||||
}))
|
||||
}
|
||||
>
|
||||
<option value={1}>단판</option>
|
||||
<option value={3}>3전 2선승</option>
|
||||
<option value={5}>5전 3선승</option>
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{form.gameMode === 'double-elimination' && (
|
||||
<label className="flex items-center gap-2 border border-base-content/10 px-3 py-2 text-xs text-base-content/55">
|
||||
<input
|
||||
type="checkbox"
|
||||
disabled={isConfigLocked}
|
||||
checked={Boolean(form.doubleEliminationResetFinalEnabled)}
|
||||
onChange={(event) =>
|
||||
setForm((current) => ({
|
||||
@@ -493,7 +533,7 @@ export default function MatchAdminPage() {
|
||||
}))
|
||||
}
|
||||
/>
|
||||
그랜드 파이널 리셋 허용
|
||||
그랜드 파이널 리셋 허용 (리셋 경기는 단판)
|
||||
</label>
|
||||
)}
|
||||
<label className="text-xs text-base-content/45">
|
||||
|
||||
Reference in new issue
Block a user