feat: reset to system-calculated ranking order
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m34s
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m34s
Adds a 'Reset to system order' button per category (Startups and Business Concepts). The button only appears when admins have drag-reordered that category — otherwise there's nothing to reset. Clicking it wipes that category's reorder history from the snapshot's reordersJson via a new ranking.clearReorders mutation, after which the dashboard re-initializes and falls back to the live composite ranking (balanced/raw score, optionally blended with balanced pass rate per the toggles). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -264,6 +264,32 @@ export const rankingRouter = router({
|
||||
return { ok: true }
|
||||
}),
|
||||
|
||||
/** Clear all manual drag-reorders for a snapshot, optionally filtered by
|
||||
* category. The next dashboard render falls back to the system-computed
|
||||
* order. Append-only history of reorders is wiped — that's the point. */
|
||||
clearReorders: adminProcedure
|
||||
.input(
|
||||
z.object({
|
||||
snapshotId: z.string(),
|
||||
category: z.enum(['STARTUP', 'BUSINESS_CONCEPT']).optional(),
|
||||
}),
|
||||
)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const snapshot = await ctx.prisma.rankingSnapshot.findUniqueOrThrow({
|
||||
where: { id: input.snapshotId },
|
||||
select: { reordersJson: true },
|
||||
})
|
||||
const existing = (snapshot.reordersJson as ReorderEvent[] | null) ?? []
|
||||
const next = input.category
|
||||
? existing.filter((r) => r.category !== input.category)
|
||||
: []
|
||||
await ctx.prisma.rankingSnapshot.update({
|
||||
where: { id: input.snapshotId },
|
||||
data: { reordersJson: next as unknown as Prisma.InputJsonValue },
|
||||
})
|
||||
return { ok: true, cleared: existing.length - next.length }
|
||||
}),
|
||||
|
||||
/**
|
||||
* RANK-09 — Manual trigger for auto-rank (admin button on round detail page).
|
||||
* Reads ranking criteria from round configJson and executes quickRank.
|
||||
|
||||
Reference in New Issue
Block a user