From 700e7b478bb9ae647c7920abb15872bf4b47a835 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 11 May 2024 14:51:01 +0200 Subject: [PATCH] Show talks that have been on past days Technically, if a talk is due to be given today, it hasn't been presented yet and shouldn't be included within the talk count. This commit changes the comparison to match on talks that were given yesterday instead of today. --- web/modules/custom/talks/src/Service/TalkCounter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/modules/custom/talks/src/Service/TalkCounter.php b/web/modules/custom/talks/src/Service/TalkCounter.php index 4d132b0..fe95fcd 100644 --- a/web/modules/custom/talks/src/Service/TalkCounter.php +++ b/web/modules/custom/talks/src/Service/TalkCounter.php @@ -17,13 +17,13 @@ final class TalkCounter { } public function getCount(): int { - $today = Carbon::today()->format('Y-m-d H:i:s'); + $yesterday = Carbon::yesterday()->format('Y-m-d H:i:s'); return $this->talkRepository ->findAllPublished() ->getEvents() ->filter(fn(ParagraphInterface $event) => $event->get('field_date') - ->getString() <= $today) + ->getString() <= $yesterday) ->count(); }