Add a 'paused' state (#1265)

* Add a 'paused' state

* Check paused status
This commit is contained in:
Nabeel S
2021-07-22 11:59:52 -04:00
committed by GitHub
parent f8ded4e410
commit f42a41286d
9 changed files with 20 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Cron\Hourly;
use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Models\Enums\PirepState;
use App\Models\Enums\PirepStatus;
use App\Models\Pirep;
use App\Services\PirepService;
use Carbon\Carbon;
@@ -38,7 +39,10 @@ class DeletePireps extends Listener
protected function deletePireps(int $expire_time_hours, int $state)
{
$dt = Carbon::now('UTC')->subHours($expire_time_hours);
$pireps = Pirep::where('created_at', '<', $dt)->where(['state' => $state])->get();
$pireps = Pirep::where('created_at', '<', $dt)
->where(['state' => $state])
->where(['status', '<>', PirepStatus::PAUSED])
->get();
/** @var PirepService $pirepSvc */
$pirepSvc = app(PirepService::class);