feat: render project averages to two decimals
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m15s

Project-level averages (Raw + Balanced in the side panel, observer
project detail score card, observer preview dialog Avg Score) now
show two decimals (e.g. 8.33 instead of 8.0/8.3) so admins can see
the actual computed value. Per-juror individual scores keep one
decimal — they're submissions, not aggregates. ScorePill gains an
optional precision prop so call sites can opt into 2-decimal display
where the value is an aggregate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt
2026-04-27 13:32:52 +02:00
parent 3b12078e04
commit 9db8312b96
3 changed files with 7 additions and 7 deletions

View File

@@ -197,7 +197,7 @@ function SortableProjectRow({
</div>
) : entry?.avgGlobalScore !== null && entry?.avgGlobalScore !== undefined ? (
<span className="text-xs text-muted-foreground">
Avg {entry.avgGlobalScore.toFixed(1)}
Avg {entry.avgGlobalScore.toFixed(2)}
</span>
) : null}
@@ -1067,12 +1067,12 @@ export function RankingDashboard({ competitionId: _competitionId, roundId }: Ran
<div className="flex items-baseline gap-4 flex-wrap">
<div className={`flex items-baseline gap-1 ${useBalanced ? 'text-muted-foreground' : 'font-semibold'}`}>
<span className="text-xs">Raw</span>
<span className="text-lg tabular-nums">{raw != null ? raw.toFixed(1) : '—'}</span>
<span className="text-lg tabular-nums">{raw != null ? raw.toFixed(2) : '—'}</span>
{!useBalanced && <span className="ml-1 text-[10px] text-muted-foreground"> used for ranking</span>}
</div>
<div className={`flex items-baseline gap-1 ${useBalanced ? 'font-semibold' : 'text-muted-foreground'}`}>
<span className="text-xs">Balanced</span>
<span className="text-lg tabular-nums">{balanced != null ? balanced.toFixed(1) : '—'}</span>
<span className="text-lg tabular-nums">{balanced != null ? balanced.toFixed(2) : '—'}</span>
{useBalanced && <span className="ml-1 text-[10px] text-muted-foreground"> used for ranking</span>}
</div>
</div>

View File

@@ -235,7 +235,7 @@ export function ObserverProjectDetail({
</div>
<p className="mt-2 text-4xl font-bold tabular-nums">
{stats.averageGlobalScore != null
? stats.averageGlobalScore.toFixed(1)
? stats.averageGlobalScore.toFixed(2)
: '-'}
</p>
<p className="text-xs text-muted-foreground">

View File

@@ -27,7 +27,7 @@ interface ProjectPreviewDialogProps {
onOpenChange: (open: boolean) => void
}
function ScorePill({ score }: { score: number }) {
function ScorePill({ score, precision = 1 }: { score: number; precision?: 1 | 2 }) {
const bg = scoreGradient(score)
const text = score >= 6 ? '#ffffff' : '#1a1a1a'
return (
@@ -35,7 +35,7 @@ function ScorePill({ score }: { score: number }) {
className="inline-flex items-center justify-center rounded-md px-2.5 py-1 text-sm font-bold tabular-nums"
style={{ backgroundColor: bg, color: text }}
>
{score.toFixed(1)}
{score.toFixed(precision)}
</span>
)
}
@@ -117,7 +117,7 @@ export function ProjectPreviewDialog({ projectId, roundId, open, onOpenChange }:
<div className="rounded-md border p-3 text-center">
<p className="text-lg font-bold tabular-nums">
{data.stats.averageGlobalScore != null ? (
<ScorePill score={data.stats.averageGlobalScore} />
<ScorePill score={data.stats.averageGlobalScore} precision={2} />
) : '—'}
</p>
<p className="text-xs text-muted-foreground mt-1">Avg Score</p>