Crowd Pick 비율 합이 항상 100% 되도록 반올림 보정

This commit is contained in:
JinwooKim committed 2026-06-19 11:05:13 +09:00
1 parent 0a64a220ca
commit 8580bbb713
2 files changed
+27 -6

No files matched your search

+6 -6
View File
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useState } from "react";
import { outcomeLabel, pct, kickoffDisplay, winProb } from "@/lib/format";
import { outcomeLabel, pctParts, kickoffDisplay, winProb } from "@/lib/format";
import { type Lang, dict, teamShort } from "@/lib/i18n";
import type {
Outcome,
@@ -542,15 +542,15 @@ export default function Arena({
Crowd Pick{" "}
<span className="text-[14px] text-[var(--ink-muted)]">{t.crowdSub}</span>
</div>
{/* 비율은 분포 합 기준(=total 과 동일해야 정상) — 구 데이터 불일치 시에도 100% 이내로 표시 */}
{/* 비율은 분포 합 기준 + 합이 항상 100% 되도록 보정(최대 잔여 방식) */}
<div className="flex h-14 overflow-hidden rounded-2xl border border-[var(--line-d)]">
{(() => {
const sum = crowd.teamAWin + crowd.draw + crowd.teamBWin;
const [a, d, b] = pctParts([crowd.teamAWin, crowd.draw, crowd.teamBWin]);
return (
<>
<CrowdSeg team={match.teamA} value={pct(crowd.teamAWin, sum)} tone="a" />
<CrowdSeg value={pct(crowd.draw, sum)} tone="draw" />
<CrowdSeg team={match.teamB} value={pct(crowd.teamBWin, sum)} tone="b" />
<CrowdSeg team={match.teamA} value={a} tone="a" />
<CrowdSeg value={d} tone="draw" />
<CrowdSeg team={match.teamB} value={b} tone="b" />
</>
);
})()}