Skip to content

Commit 5a5c804

Browse files
committed
Decrease pass threshold for old evals
1 parent cdb1738 commit 5a5c804

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/_components/DocumentEditor/Editor/Playground/DocumentEvaluations/BoxContent.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
import { normalizeNumber } from '$/lib/normalizeNumber'
12
import { ROUTES } from '$/services/routes'
2-
import { useMemo } from 'react'
3-
43
import {
54
EvaluationResultableType,
65
EvaluationResultDto,
76
EvaluationResultV2,
87
} from '@latitude-data/core/browser'
98
import { Badge, Button, Skeleton, Text } from '@latitude-data/web-ui'
109
import Link from 'next/link'
11-
10+
import { useMemo } from 'react'
1211
import EvaluationItem from './EvaluationItem'
1312
import { Props } from './shared'
1413

@@ -107,7 +106,11 @@ export function CollapsedContentHeader({
107106

108107
if (evaluation.resultType === EvaluationResultableType.Number) {
109108
value = Number(value)
110-
return value >= evaluation.resultConfiguration.maxValue
109+
return normalizeNumber(
110+
value,
111+
evaluation.resultConfiguration.minValue,
112+
evaluation.resultConfiguration.maxValue,
113+
) >= 0.75
111114
? { ...acc, passed: acc.passed + 1 }
112115
: acc
113116
}

apps/web/src/app/(private)/projects/[projectId]/versions/[commitUuid]/documents/[documentUuid]/logs/_components/DocumentLogs/DocumentLogsTable.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { formatCostInMillicents, formatDuration } from '$/app/_lib/formatUtils'
55
import { useCurrentDocument } from '$/app/providers/DocumentProvider'
66
import { LinkableTablePaginationFooter } from '$/components/TablePaginationFooter'
77
import { SelectableRowsHook } from '$/hooks/useSelectableRows'
8+
import { normalizeNumber } from '$/lib/normalizeNumber'
89
import { relativeTime } from '$/lib/relativeTime'
910
import { ROUTES } from '$/services/routes'
1011
import useDocumentLogsPagination from '$/stores/useDocumentLogsPagination'
@@ -67,12 +68,13 @@ function EvaluationsColumn({
6768
}
6869

6970
if (result.resultableType === EvaluationResultableType.Number) {
70-
return (
71-
Number(value) >=
72-
((
73-
evaluation.resultConfiguration as EvaluationConfigurationNumerical
74-
)?.maxValue ?? 0)
75-
)
71+
const minValue = (
72+
evaluation.resultConfiguration as EvaluationConfigurationNumerical
73+
)?.minValue
74+
const maxValue = (
75+
evaluation.resultConfiguration as EvaluationConfigurationNumerical
76+
)?.maxValue
77+
return normalizeNumber(Number(value), minValue, maxValue) >= 0.75
7678
}
7779

7880
return true

apps/web/src/lib/normalizeNumber.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export function normalizeNumber(score: number, lower: number, upper: number) {
2+
const range = Math.abs(upper - lower)
3+
const value = Math.abs(score - lower)
4+
const map = (value * 1) / range
5+
return Math.min(Math.max(map, 0), 1)
6+
}

0 commit comments

Comments
 (0)