From 3a744eba92b880c7e8d0b3e6814c64454efe6175 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Tue, 23 Jul 2024 02:22:07 +0800 Subject: [PATCH] fix exam can not assign again --- app/Repositories/ExamRepository.php | 2 +- include/constants.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Repositories/ExamRepository.php b/app/Repositories/ExamRepository.php index 25c15f2c..c14ccdea 100644 --- a/app/Repositories/ExamRepository.php +++ b/app/Repositories/ExamRepository.php @@ -385,7 +385,7 @@ 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 = $user->exams()->where('exam_id', $exam->id)->exists(); + $exists = ExamUser::query()->where('exam_id', $exam->id)->where("status", ExamUser::STATUS_NORMAL)->exists(); if ($exists) { throw new NexusException(nexus_trans('exam.claimed_already', [], $locale)); } diff --git a/include/constants.php b/include/constants.php index 42823307..4dcbbf5d 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@