Update AcarsRepository (#1245)

* Update AcarsRepository.php

Use `where` instead of `whereDate` , as you know whereDate only checks the date, it skips the time part completely, thus not providing correct live pireps collection.

* Switch from created_at to updated_at

Also remove the UTC conversion 'cause `updated_at` field is not being populated with UTC values.
This commit is contained in:
B.Fatih KOZ 2021-06-14 14:05:28 +03:00 committed by GitHub
parent bd9c429cfc
commit b6a2fe405d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,11 +69,11 @@ class AcarsRepository extends Repository
->where(['state' => PirepState::IN_PROGRESS]); ->where(['state' => PirepState::IN_PROGRESS]);
if ($live_time !== null && $live_time > 0) { if ($live_time !== null && $live_time > 0) {
$st = Carbon::now('UTC')->subHours($live_time); $st = Carbon::now()->subHours($live_time);
$q = $q->whereDate('created_at', '>=', $st); $q = $q->where('updated_at', '>=', $st);
} }
$q = $q->orderBy('created_at', 'desc'); $q = $q->orderBy('updated_at', 'desc');
return $q->get(); return $q->get();
} }