add donate until

This commit is contained in:
xiaomlove
2022-04-19 19:18:52 +08:00
parent 7267fb884b
commit 41e3ba55ee
10 changed files with 16 additions and 9 deletions

View File

@@ -800,10 +800,10 @@ class ExamRepository extends BaseRepository
if (!empty($filters->$filter) && count($filters->$filter) == 1) {
$donateStatus = $filters->$filter[0];
if ($donateStatus == User::DONATE_YES) {
$baseQuery->where("$userTable.donoruntil", ">=", Carbon::now()->toDateTimeString());
$baseQuery->where('donor', 'yes')->where("$userTable.donoruntil", ">=", Carbon::now()->toDateTimeString());
} elseif ($donateStatus == User::DONATE_NO) {
$baseQuery->where(function (Builder $query) use ($userTable) {
$query->whereNull("$userTable.donoruntil")->orWhere("$userTable.donoruntil", '<', Carbon::now()->toDateTimeString());
$query->where('donor', 'no')->orWhereNull("$userTable.donoruntil")->orWhere("$userTable.donoruntil", '<', Carbon::now()->toDateTimeString());
});
} else {
do_log("{$exam->id} filter $filter: $donateStatus invalid.", "error");

View File

@@ -1013,7 +1013,7 @@ class TrackerRepository extends BaseRepository
if ($user->class >= \App\Models\HitAndRun::MINIMUM_IGNORE_USER_CLASS) {
return;
}
if ($user->donoruntil && $user->donoruntil->gte($now)) {
if ($user->isDonating()) {
return;
}
$hrMode = Setting::get('hr.mode');