fix: wrong base case

pull/1/head
Antonio De Lucreziis 2 years ago
parent 8fdef2981d
commit c8c33c9aa0

@ -197,7 +197,7 @@ export async function createApiRouter() {
return
}
const problemNextId = (await getProblems(db)).map(p => parseInt(p.id)).reduce((acc, v) => Math.max(acc, v), 1) + 1
const problemNextId = (await getProblems(db)).map(p => parseInt(p.id)).reduce((acc, v) => Math.max(acc, v), 0) + 1
const id = await createProblem(db, {
title: req.body.title ?? `Problema ${problemNextId}`,

Loading…
Cancel
Save