diff --git a/.yarn/versions/b30e0517.yml b/.yarn/versions/b30e0517.yml new file mode 100644 index 0000000..1a06f8b --- /dev/null +++ b/.yarn/versions/b30e0517.yml @@ -0,0 +1,2 @@ +releases: + "@aoi-js/server": patch diff --git a/apps/server/src/routes/problem/scoped.ts b/apps/server/src/routes/problem/scoped.ts index 2c77097..2c1a421 100644 --- a/apps/server/src/routes/problem/scoped.ts +++ b/apps/server/src/routes/problem/scoped.ts @@ -152,9 +152,9 @@ export const problemScopedRoutes = defineRoutes(async (s) => { solutionCount: upserted && maxSolutionCount ? { $lt: maxSolutionCount } : undefined }, { - $inc: upserted ? { solutionCount: 1 } : undefined, + $inc: { solutionCount: upserted ? 1 : undefined }, $set: { lastSolutionId: value._id, lastSolutionScore: 0, lastSolutionStatus: '' }, - $setOnInsert: { _id: new BSON.UUID() } + $setOnInsert: { _id: new BSON.UUID(), solutionCount: upserted ? undefined : 0 } }, { upsert: true, ignoreUndefined: true } )