From eae609e92738b46734aee3576f8e1d01221e03f4 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Sat, 3 Aug 2024 18:36:59 +0800 Subject: [PATCH] fix assignToUser --- app/Repositories/ExamRepository.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Repositories/ExamRepository.php b/app/Repositories/ExamRepository.php index 23bbfcf7..f5544da5 100644 --- a/app/Repositories/ExamRepository.php +++ b/app/Repositories/ExamRepository.php @@ -386,7 +386,12 @@ class ExamRepository extends BaseRepository if ($user->exams()->where('status', ExamUser::STATUS_NORMAL)->exists()) { throw new NexusException(nexus_trans('exam.has_other_on_the_way', ['type_text' => $exam->typeText], $locale)); } - $exists = ExamUser::query()->where('exam_id', $exam->id)->where("status", ExamUser::STATUS_NORMAL)->exists(); + $exists = ExamUser::query() + ->where("uid", $uid) + ->where('exam_id', $exam->id) + ->where("status", ExamUser::STATUS_NORMAL) + ->exists() + ; if ($exists) { throw new NexusException(nexus_trans('exam.claimed_already', [], $locale)); }