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:
parent
bd9c429cfc
commit
b6a2fe405d
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user