Fix import during flight cron #532 (#535)

This commit is contained in:
Nabeel S 2020-02-01 13:54:30 -05:00 committed by GitHub
parent 8cde3c93b0
commit 893e28eb3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ namespace App\Cron\Hourly;
use App\Contracts\Listener;
use App\Events\CronHourly;
use App\Models\Enums\PirepState;
use App\Models\Pirep;
use Carbon\Carbon;
@ -13,7 +14,7 @@ use Carbon\Carbon;
class RemoveExpiredLiveFlights extends Listener
{
/**
* Remove expired live flights
* Remove expired live flights that haven't had an update in the live time
*
* @param CronHourly $event
*
@ -26,7 +27,7 @@ class RemoveExpiredLiveFlights extends Listener
}
$date = Carbon::now()->subHours(setting('acars.live_time'));
Pirep::whereDate('created_at', '<', $date)
Pirep::whereDate('updated_at', '<', $date)
->where('state', PirepState::IN_PROGRESS)
->delete();
}