feat(web): improve competition result history
Prioritize match outcomes, distinguish adjudicated results, and preserve detail context when navigating back.
This commit is contained in:
1 parent
dc77b37494
commit
43c25c05cd
5 files changed
+335
-143
No files matched your search
@@ -12,8 +12,11 @@ import {
|
||||
competitionHistoryGameDetailPath,
|
||||
createCompetitionSeriesHistory,
|
||||
formatCompetitionHistoryDate,
|
||||
formatCompetitionHistoryDayHeading,
|
||||
formatCompetitionHistoryTime,
|
||||
formatSeriesGameDuration,
|
||||
getSeriesHistoryRecordLabel,
|
||||
getSeriesHistoryResultLabel,
|
||||
getSeriesHistoryStatusLabel,
|
||||
shouldDisplaySeriesHistoryScore,
|
||||
} from "../src/components/competition/competition-series-history.ts";
|
||||
@@ -234,74 +237,108 @@ test("sorts tied timestamps deterministically and ignores orphan Games", () => {
|
||||
assert.equal(rows.every(({ games }) => games.length === 0), true);
|
||||
});
|
||||
|
||||
test("returns explicit status labels for played and adjudicated outcomes", () => {
|
||||
test("separates lifecycle status from played and adjudicated result labels", () => {
|
||||
const teamA = teamId("team-a");
|
||||
const teamB = teamId("team-b");
|
||||
const running = inProgressSeries("running", teamA, teamB, 1, 0);
|
||||
const played = completedSeries({
|
||||
id: "played",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 2,
|
||||
scoreB: 1,
|
||||
});
|
||||
const playedDraw = completedSeries({
|
||||
id: "played-draw",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 1,
|
||||
scoreB: 1,
|
||||
outcome: "draw",
|
||||
});
|
||||
const administrativeDraw = {
|
||||
...playedDraw,
|
||||
seriesId: seriesId("administrative-draw-label"),
|
||||
outcome: {
|
||||
...playedDraw.outcome,
|
||||
basis: {
|
||||
type: "administrative" as const,
|
||||
decisionFactId: "draw-label-fact" as never,
|
||||
},
|
||||
},
|
||||
};
|
||||
const walkover = completedSeries({
|
||||
id: "walkover",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 0,
|
||||
scoreB: 0,
|
||||
outcome: "walkover",
|
||||
});
|
||||
const forfeit = completedSeries({
|
||||
id: "forfeit",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 1,
|
||||
scoreB: 1,
|
||||
outcome: "forfeit",
|
||||
});
|
||||
const administrative = completedSeries({
|
||||
id: "administrative",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 0,
|
||||
scoreB: 0,
|
||||
outcome: "administrative",
|
||||
});
|
||||
|
||||
assert.equal(getSeriesHistoryStatusLabel(running), "진행 중");
|
||||
for (const completed of [
|
||||
played,
|
||||
playedDraw,
|
||||
administrativeDraw,
|
||||
walkover,
|
||||
forfeit,
|
||||
administrative,
|
||||
]) {
|
||||
assert.equal(getSeriesHistoryStatusLabel(completed), "최종");
|
||||
}
|
||||
|
||||
assert.equal(getSeriesHistoryResultLabel(running), null);
|
||||
assert.equal(getSeriesHistoryResultLabel(played), null);
|
||||
assert.equal(getSeriesHistoryResultLabel(playedDraw), "무승부");
|
||||
assert.equal(
|
||||
getSeriesHistoryStatusLabel(
|
||||
inProgressSeries("running", teamA, teamB, 1, 0),
|
||||
),
|
||||
"진행 중",
|
||||
);
|
||||
assert.equal(
|
||||
getSeriesHistoryStatusLabel(
|
||||
completedSeries({ id: "played", teamA, teamB, scoreA: 2, scoreB: 1 }),
|
||||
),
|
||||
"종료",
|
||||
);
|
||||
assert.equal(
|
||||
getSeriesHistoryStatusLabel(
|
||||
completedSeries({
|
||||
id: "draw",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 1,
|
||||
scoreB: 1,
|
||||
outcome: "draw",
|
||||
}),
|
||||
),
|
||||
"무승부",
|
||||
);
|
||||
assert.equal(
|
||||
getSeriesHistoryStatusLabel(
|
||||
completedSeries({
|
||||
id: "walkover",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 0,
|
||||
scoreB: 0,
|
||||
outcome: "walkover",
|
||||
}),
|
||||
),
|
||||
"부전승",
|
||||
);
|
||||
assert.equal(
|
||||
getSeriesHistoryStatusLabel(
|
||||
completedSeries({
|
||||
id: "forfeit",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 1,
|
||||
scoreB: 1,
|
||||
outcome: "forfeit",
|
||||
}),
|
||||
),
|
||||
"기권승",
|
||||
);
|
||||
assert.equal(
|
||||
getSeriesHistoryStatusLabel(
|
||||
completedSeries({
|
||||
id: "administrative",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 0,
|
||||
scoreB: 0,
|
||||
outcome: "administrative",
|
||||
}),
|
||||
),
|
||||
"판정",
|
||||
getSeriesHistoryResultLabel(administrativeDraw),
|
||||
"판정 무승부",
|
||||
);
|
||||
assert.equal(getSeriesHistoryResultLabel(walkover), "부전승");
|
||||
assert.equal(getSeriesHistoryResultLabel(forfeit), "기권승");
|
||||
assert.equal(getSeriesHistoryResultLabel(administrative), "판정승");
|
||||
});
|
||||
|
||||
test("describes recorded Games, decisions, and legacy missing records", () => {
|
||||
const teamA = teamId("record-team-a");
|
||||
const teamB = teamId("record-team-b");
|
||||
const played = completedSeries({
|
||||
id: "recorded-played",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 2,
|
||||
scoreB: 0,
|
||||
});
|
||||
const decision = completedSeries({
|
||||
id: "recorded-decision",
|
||||
teamA,
|
||||
teamB,
|
||||
scoreA: 0,
|
||||
scoreB: 0,
|
||||
outcome: "walkover",
|
||||
});
|
||||
|
||||
assert.equal(getSeriesHistoryRecordLabel(played, 2, false), "게임 상세 (2)");
|
||||
assert.equal(getSeriesHistoryRecordLabel(played, 2, true), "게임 상세 접기");
|
||||
assert.equal(getSeriesHistoryRecordLabel(decision, 0, false), "경기 없이 결정");
|
||||
assert.equal(getSeriesHistoryRecordLabel(played, 0, false), "게임 기록 미등록");
|
||||
});
|
||||
|
||||
test("shows a numeric score only for played records", () => {
|
||||
@@ -386,12 +423,25 @@ test("formats recorded Game duration and omits unknown legacy zero values", () =
|
||||
});
|
||||
|
||||
test("formats history dates and times explicitly in Asia/Seoul", () => {
|
||||
assert.equal(formatCompetitionHistoryDate("2026-07-13"), "07월 13일 (월)");
|
||||
assert.equal(formatCompetitionHistoryDate("2026-07-05"), "7월 5일 (일)");
|
||||
assert.equal(formatCompetitionHistoryDate("2026-07-13"), "7월 13일 (월)");
|
||||
assert.equal(
|
||||
formatCompetitionHistoryDayHeading("2026-07-05", 1),
|
||||
"7월 5일 (일) · 1경기",
|
||||
);
|
||||
assert.equal(
|
||||
formatCompetitionHistoryDayHeading("2026-07-13", 2),
|
||||
"7월 13일 (월) · 2경기",
|
||||
);
|
||||
assert.equal(
|
||||
formatCompetitionHistoryTime("2026-07-12T15:05:00.000Z"),
|
||||
"00:05",
|
||||
);
|
||||
assert.equal(formatCompetitionHistoryDate("unknown"), "일시 정보 없음");
|
||||
assert.equal(
|
||||
formatCompetitionHistoryDayHeading("unknown", 1),
|
||||
"일시 정보 없음 · 1경기",
|
||||
);
|
||||
});
|
||||
|
||||
function playedSeriesWithGame({
|
||||
|
||||
Reference in new issue
Block a user