Skip to content

Commit

Permalink
🐛 fix detection of extended checkin time (#2929)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu authored Sep 24, 2024
1 parent b0768c8 commit cb7766e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app/Models/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion resources/views/events/overview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
</td>
Expand Down

0 comments on commit cb7766e

Please sign in to comment.