From ec8e7b905d05cba673535988f57dd6215545280e Mon Sep 17 00:00:00 2001 From: nairobi <61069237+nyairobi@users.noreply.github.com> Date: Mon, 14 Jul 2025 15:22:56 +0000 Subject: [PATCH] fix(client): platinum rounding and graph truncation (#1324) --- client/src/components/charts/GekichumaiScoreChart.tsx | 10 +++++----- .../components/tables/cells/OngekiPlatinumCell.tsx | 11 +++++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/client/src/components/charts/GekichumaiScoreChart.tsx b/client/src/components/charts/GekichumaiScoreChart.tsx index 96e2c4feb..5b809abb4 100644 --- a/client/src/components/charts/GekichumaiScoreChart.tsx +++ b/client/src/components/charts/GekichumaiScoreChart.tsx @@ -211,7 +211,7 @@ export default function GekichumaiScoreChart({ const gradientId = type === "Score" ? difficulty : type; - data.length = Math.min(data.length, duration + 1); + data[0].data.length = Math.min(data[0].data.length, duration + 1); const commonProps: Omit = { margin: { top: 30, bottom: 50, left: 50, right: 50 }, @@ -262,8 +262,8 @@ export default function GekichumaiScoreChart({ tooltip={(d: PointTooltipProps) => ( {typeof d.point.data.y === "number" && d.point.data.y < 970_000 - ? "< 970,000 " - : d.point.data.yFormatted} + ? "< 970,000" + : d.point.data.yFormatted}{" "} @ {formatTime(d.point.data.x)} )} @@ -287,8 +287,8 @@ export default function GekichumaiScoreChart({ tooltip={(d: PointTooltipProps) => ( {typeof d.point.data.y === "number" && d.point.data.y < 990_000 - ? "< 990,000 " - : d.point.data.yFormatted} + ? "< 990,000" + : d.point.data.yFormatted}{" "} @ {formatTime(d.point.data.x)} )} diff --git a/client/src/components/tables/cells/OngekiPlatinumCell.tsx b/client/src/components/tables/cells/OngekiPlatinumCell.tsx index dfa40bc9a..572d0dab4 100644 --- a/client/src/components/tables/cells/OngekiPlatinumCell.tsx +++ b/client/src/components/tables/cells/OngekiPlatinumCell.tsx @@ -34,12 +34,19 @@ export default function OngekiPlatinumCell({ maxPlatScore: integer; stars: number; }) { - const percentage = Math.round((platinumScore * 10000.0) / maxPlatScore) / 100.0; + const percentage = (platinumScore / maxPlatScore) * 100; return (
- {percentage.toFixed(2)}% + + {percentage.toLocaleString("en-US", { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + roundingMode: "trunc", + } as Intl.NumberFormatOptions)} + % + [{platinumScore}/{maxPlatScore}]