Skip to content

Commit

Permalink
fix exam
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed May 14, 2023
1 parent c5ceaf0 commit dd97740
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/Repositories/ExamRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,21 @@ private function isExamMatchUser(Exam $exam, $user): bool
$filters = $exam->filters;

$filter = Exam::FILTER_USER_CLASS;
$filterValues = $filters[$filter];
$filterValues = $filters[$filter] ?? [];
if (!empty($filterValues) && !in_array($user->class, $filterValues)) {
do_log("$logPrefix, user class: {$user->class} not in: " . json_encode($filterValues));
return false;
}

$filter = Exam::FILTER_USER_DONATE;
$filterValues = $filters[$filter];
$filterValues = $filters[$filter] ?? [];
if (!empty($filterValues) && !in_array($user->donate_status, $filterValues)) {
do_log("$logPrefix, user donate status: {$user->donate_status} not in: " . json_encode($filterValues));
return false;
}

$filter = Exam::FILTER_USER_REGISTER_TIME_RANGE;
$filterValues = $filters[$filter];
$filterValues = $filters[$filter] ?? [];
$added = $user->added->toDateTimeString();
$registerTimeBegin = isset($filterValues[0]) ? Carbon::parse($filterValues[0])->toDateTimeString() : '';
$registerTimeEnd = isset($filterValues[1]) ? Carbon::parse($filterValues[1])->toDateTimeString() : '';
Expand Down Expand Up @@ -868,7 +868,7 @@ public function fetchUserAndDoAssign(Exam $exam): bool|int
}

$filter = Exam::FILTER_USER_REGISTER_TIME_RANGE;
$range = $filters[$filter];
$range = $filters[$filter] ?? [];
if (!empty($range)) {
if (!empty($range[0])) {
$baseQuery->where("$userTable.added", ">=", Carbon::parse($range[0])->toDateTimeString());
Expand Down
4 changes: 2 additions & 2 deletions include/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.37');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-05-08');
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.38');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-05-14');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
Expand Down

0 comments on commit dd97740

Please sign in to comment.