fix: override badge only shows when admin actually reordered a project
All checks were successful
Build and Push Docker Image / build (push) Successful in 10m17s
All checks were successful
Build and Push Docker Image / build (push) Successful in 10m17s
Compare against original snapshot array position, not AI's internal rank number. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,7 @@ type JurorScore = {
|
||||
type SortableProjectRowProps = {
|
||||
projectId: string
|
||||
currentRank: number
|
||||
entry: RankedProjectEntry | undefined
|
||||
entry: (RankedProjectEntry & { originalIndex?: number }) | undefined
|
||||
projectInfo: ProjectInfo | undefined
|
||||
jurorScores: JurorScore[] | undefined
|
||||
onSelect: () => void
|
||||
@@ -117,8 +117,8 @@ function SortableProjectRow({
|
||||
transition,
|
||||
}
|
||||
|
||||
// isOverridden: current position differs from AI-assigned rank
|
||||
const isOverridden = entry !== undefined && currentRank !== entry.rank
|
||||
// isOverridden: admin drag-reordered this project from its original snapshot position
|
||||
const isOverridden = entry !== undefined && currentRank !== entry.originalIndex
|
||||
|
||||
// Compute yes count from juror scores
|
||||
const yesCount = jurorScores?.filter((j) => j.decision === true).length ?? 0
|
||||
@@ -372,11 +372,12 @@ export function RankingDashboard({ competitionId: _competitionId, roundId }: Ran
|
||||
|
||||
// ─── rankingMap (O(1) lookup) ──────────────────────────────────────────────
|
||||
const rankingMap = useMemo(() => {
|
||||
const map = new Map<string, RankedProjectEntry>()
|
||||
const map = new Map<string, RankedProjectEntry & { originalIndex: number }>()
|
||||
if (!snapshot) return map
|
||||
const startup = (snapshot.startupRankingJson ?? []) as unknown as RankedProjectEntry[]
|
||||
const concept = (snapshot.conceptRankingJson ?? []) as unknown as RankedProjectEntry[]
|
||||
;[...startup, ...concept].forEach((entry) => map.set(entry.projectId, entry))
|
||||
startup.forEach((entry, i) => map.set(entry.projectId, { ...entry, originalIndex: i + 1 }))
|
||||
concept.forEach((entry, i) => map.set(entry.projectId, { ...entry, originalIndex: i + 1 }))
|
||||
return map
|
||||
}, [snapshot])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user