From b6a2fe405db35f1cba65f32c7acb5d8e7ec31fd5 Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Mon, 14 Jun 2021 14:05:28 +0300 Subject: [PATCH] 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. --- app/Repositories/AcarsRepository.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Repositories/AcarsRepository.php b/app/Repositories/AcarsRepository.php index 43d8776e..f64c575d 100644 --- a/app/Repositories/AcarsRepository.php +++ b/app/Repositories/AcarsRepository.php @@ -69,11 +69,11 @@ class AcarsRepository extends Repository ->where(['state' => PirepState::IN_PROGRESS]); if ($live_time !== null && $live_time > 0) { - $st = Carbon::now('UTC')->subHours($live_time); - $q = $q->whereDate('created_at', '>=', $st); + $st = Carbon::now()->subHours($live_time); + $q = $q->where('updated_at', '>=', $st); } - $q = $q->orderBy('created_at', 'desc'); + $q = $q->orderBy('updated_at', 'desc'); return $q->get(); }