From 1d36c31624baf5a0be659dd0fceff61099f39cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20St=C3=B6ckel?= Date: Tue, 24 Sep 2024 20:52:31 +0200 Subject: [PATCH] :bug: fix detection of extended checkin time --- app/Models/Event.php | 10 ++++++++-- resources/views/events/overview.blade.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Models/Event.php b/app/Models/Event.php index 50856050d..89c6df1fa 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -33,6 +33,7 @@ * @property bool isPride * @property Carbon start Timestamp of event starts (returns event_start or checkin_start) * @property Carbon end Timestamp of event ends (returns event_end or checkin_end) + * @property bool hasExtendedCheckin */ class Event extends Model { @@ -83,11 +84,16 @@ public function getIsPrideAttribute(): bool { } public function getStartAttribute(): Carbon { - return $this->event_start?$this->event_start:$this->checkin_start; + return $this->event_start ? $this->event_start : $this->checkin_start; } public function getEndAttribute(): Carbon { - return $this->event_end?$this->event_end:$this->checkin_end; + return $this->event_end ? $this->event_end : $this->checkin_end; + } + + public function getHasExtendedCheckinAttribute(): bool { + return ($this->event_start && $this->event_start != $this->checkin_start) + || ($this->event_end && $this->event_end != $this->checkin_end); } public function approvedBy(): HasOne { diff --git a/resources/views/events/overview.blade.php b/resources/views/events/overview.blade.php index 4d0437105..baa977e6c 100644 --- a/resources/views/events/overview.blade.php +++ b/resources/views/events/overview.blade.php @@ -46,7 +46,7 @@ {{$event->start->format('d.m.Y')}} - {{$event->end->format('d.m.Y')}} @endif - @if($event->event_start || $event->event_end) + @if($event->hasExtendedCheckin) * @endif