From 913de363a53a01eb5a811b1e44916edd92d70aec Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 7 Aug 2024 11:37:19 +0800 Subject: [PATCH] core: training: fix enroll --- packages/hydrooj/src/model/training.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hydrooj/src/model/training.ts b/packages/hydrooj/src/model/training.ts index e4182bbb5..76ba73b85 100644 --- a/packages/hydrooj/src/model/training.ts +++ b/packages/hydrooj/src/model/training.ts @@ -23,7 +23,7 @@ export async function getListStatus(domainId: string, uid: number, tids: ObjectI export async function enroll(domainId: string, tid: ObjectId, uid: number) { try { - await document.setStatus(domainId, document.TYPE_TRAINING, tid, uid, { enroll: 1 }); + await document.setIfNotStatus(domainId, document.TYPE_TRAINING, tid, uid, 'enroll', 1, 1, {}); } catch (e) { throw new TrainingAlreadyEnrollError(tid, uid); }