Skip to content

Commit 9943604

Browse files
committed
refactor: make formatScore consistent with other formatters
1 parent b8463b7 commit 9943604

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

apps/web-roo-code/src/app/evals/evals.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,27 +148,29 @@ export function Evals({
148148
</TableCell>
149149
<TableCell className="border-r">{formatCurrency(run.taskMetrics.cost)}</TableCell>
150150
<TableCell className="text-muted-foreground">
151-
{run.languageScores?.go !== undefined ? `${formatScore(run.languageScores.go)}%` : "-"}
151+
{run.languageScores?.go !== undefined
152+
? `${formatScore(run.languageScores.go)}%`
153+
: formatScore(undefined)}
152154
</TableCell>
153155
<TableCell className="text-muted-foreground">
154156
{run.languageScores?.java !== undefined
155157
? `${formatScore(run.languageScores.java)}%`
156-
: "-"}
158+
: formatScore(undefined)}
157159
</TableCell>
158160
<TableCell className="text-muted-foreground">
159161
{run.languageScores?.javascript !== undefined
160162
? `${formatScore(run.languageScores.javascript)}%`
161-
: "-"}
163+
: formatScore(undefined)}
162164
</TableCell>
163165
<TableCell className="text-muted-foreground">
164166
{run.languageScores?.python !== undefined
165167
? `${formatScore(run.languageScores.python)}%`
166-
: "-"}
168+
: formatScore(undefined)}
167169
</TableCell>
168170
<TableCell className="text-muted-foreground">
169171
{run.languageScores?.rust !== undefined
170172
? `${formatScore(run.languageScores.rust)}%`
171-
: "-"}
173+
: formatScore(undefined)}
172174
</TableCell>
173175
<TableCell className="font-bold">{run.score}%</TableCell>
174176
</TableRow>
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export const formatScore = (score: number) => Math.round(score * 100)
1+
export const formatScore = (score: number | null | undefined) => {
2+
if (score === null || score === undefined) {
3+
return "-"
4+
}
5+
return Math.round(score * 100)
6+
}

0 commit comments

Comments
 (0)