fix assignToUser

This commit is contained in:
xiaomlove
2024-08-03 18:36:59 +08:00
parent 67c83a0d0b
commit eae609e927

View File

@@ -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));
}