Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Fixes incorrect attendee check-in status display

Dave Earleyd07a85d5ae66
diff --git a/backend/app/Exports/AttendeesExport.php b/backend/app/Exports/AttendeesExport.php
index 152ec72ff..54e11a6e7 100644
--- a/backend/app/Exports/AttendeesExport.php
+++ b/backend/app/Exports/AttendeesExport.php
@@ -3,6 +3,7 @@
namespace HiEvents\Exports;
use Carbon\Carbon;
+use HiEvents\DomainObjects\AttendeeDomainObject;
use HiEvents\DomainObjects\Enums\QuestionTypeEnum;
use HiEvents\DomainObjects\QuestionDomainObject;
use HiEvents\Resources\Attendee\AttendeeResource;
@@ -58,6 +59,10 @@ class AttendeesExport implements FromCollection, WithHeadings, WithMapping, With
], $questionTitles);
}
+ /**
+ * @param AttendeeDomainObject $attendee
+ * @return array
+ */
public function map($attendee): array
{
$answers = $this->questions->map(function (QuestionDomainObject $question) use ($attendee) {
@@ -76,9 +81,9 @@ class AttendeesExport implements FromCollection, WithHeadings, WithMapping, With
$attendee->getLastName(),
$attendee->getEmail(),
$attendee->getStatus(),
- $attendee->getCheckedInAt() ? 'Yes' : 'No',
- $attendee->getCheckedInAt()
- ? Carbon::parse($attendee->getCheckedInAt())->format('Y-m-d H:i:s')
+ $attendee->getCheckIn() ? 'Yes' : 'No',
+ $attendee->getCheckIn()
+ ? Carbon::parse($attendee->getCheckIn()->getCreatedAt())->format('Y-m-d H:i:s')
: '',
$attendee->getTicketId(),
$attendee->getEventId(),
diff --git a/backend/app/Http/Actions/Attendees/ExportAttendeesAction.php b/backend/app/Http/Actions/Attendees/ExportAttendeesAction.php
index 3d36e38c4..356792393 100644
--- a/backend/app/Http/Actions/Attendees/ExportAttendeesAction.php
+++ b/backend/app/Http/Actions/Attendees/ExportAttendeesAction.php
@@ -2,11 +2,13 @@
namespace HiEvents\Http\Actions\Attendees;
+use HiEvents\DomainObjects\AttendeeCheckInDomainObject;
use HiEvents\DomainObjects\Enums\QuestionBelongsTo;
use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\DomainObjects\QuestionAndAnswerViewDomainObject;
use HiEvents\Exports\AttendeesExport;
use HiEvents\Http\Actions\BaseAction;
+use HiEvents\Repository\Eloquent\Value\Relationship;
use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface;
use HiEvents\Repository\Interfaces\QuestionRepositoryInterface;
use Maatwebsite\Excel\Facades\Excel;
@@ -31,6 +33,10 @@ class ExportAttendeesAction extends BaseAction
$attendees = $this->attendeeRepository
->loadRelation(QuestionAndAnswerViewDomainObject::class)
+ ->loadRelation(new Relationship(
+ domainObject: AttendeeCheckInDomainObject::class,
+ name: 'check_in',
+ ))
->findByEventIdForExport($eventId);
$questions = $this->questionRepository->findWhere([
diff --git a/backend/app/Http/Actions/Attendees/GetAttendeeAction.php b/backend/app/Http/Actions/Attendees/GetAttendeeAction.php
index 6d82bbbd2..f022a7349 100644
--- a/backend/app/Http/Actions/Attendees/GetAttendeeAction.php
+++ b/backend/app/Http/Actions/Attendees/GetAttendeeAction.php
@@ -2,6 +2,7 @@
namespace HiEvents\Http\Actions\Attendees;
+use HiEvents\DomainObjects\AttendeeCheckInDomainObject;
use HiEvents\DomainObjects\EventDomainObject;
use HiEvents\DomainObjects\QuestionAndAnswerViewDomainObject;
use HiEvents\DomainObjects\TicketDomainObject;
@@ -27,7 +28,7 @@ class GetAttendeeAction extends BaseAction
$this->isActionAuthorized($eventId, EventDomainObject::class);
$attendee = $this->attendeeRepository
- ->loadRelation(QuestionAndAnswerViewDomainObject::class)
+ ->loadRelation(relationship: QuestionAndAnswerViewDomainObject::class)
->loadRelation(new Relationship(
domainObject: TicketDomainObject::class,
nested: [
@@ -35,6 +36,10 @@ class GetAttendeeAction extends BaseAction
domainObject: TicketPriceDomainObject::class,
),
], name: 'ticket'))
+ ->loadRelation(new Relationship(
+ domainObject: AttendeeCheckInDomainObject::class,
+ name: 'check_in',
+ ))
->findFirstWhere([
'id' => $attendeeId,
'event_id' => $eventId,
diff --git a/backend/app/Resources/Attendee/AttendeeResource.php b/backend/app/Resources/Attendee/AttendeeResource.php
index 77a7f924f..819ea89ae 100644
--- a/backend/app/Resources/Attendee/AttendeeResource.php
+++ b/backend/app/Resources/Attendee/AttendeeResource.php
@@ -4,6 +4,7 @@ namespace HiEvents\Resources\Attendee;
use HiEvents\DomainObjects\AttendeeDomainObject;
use HiEvents\DomainObjects\Enums\QuestionBelongsTo;
+use HiEvents\Resources\CheckInList\AttendeeCheckInResource;
use HiEvents\Resources\Order\OrderResource;
use HiEvents\Resources\Question\QuestionAnswerViewResource;
use HiEvents\Resources\Ticket\TicketResource;
@@ -30,17 +31,21 @@ class AttendeeResource extends JsonResource
'public_id' => $this->getPublicId(),
'short_id' => $this->getShortId(),
'locale' => $this->getLocale(),
+ 'check_in' => $this->when(
+ condition: $this->getCheckIn() !== null,
+ value: fn() => new AttendeeCheckInResource($this->getCheckIn()),
+ ),
'ticket' => $this->when(
- !is_null($this->getTicket()),
- fn() => new TicketResource($this->getTicket()),
+ condition: !is_null($this->getTicket()),
+ value: fn() => new TicketResource($this->getTicket()),
),
'order' => $this->when(
- !is_null($this->getOrder()),
- fn() => new OrderResource($this->getOrder())
+ condition: !is_null($this->getOrder()),
+ value: fn() => new OrderResource($this->getOrder())
),
'question_answers' => $this->when(
- $this->getQuestionAndAnswerViews() !== null,
- fn() => QuestionAnswerViewResource::collection(
+ condition: $this->getQuestionAndAnswerViews() !== null,
+ value: fn() => QuestionAnswerViewResource::collection(
$this->getQuestionAndAnswerViews()
?->filter(fn($qav) => $qav->getBelongsTo() === QuestionBelongsTo::TICKET->name)
)
diff --git a/backend/app/Resources/CheckInList/AttendeeCheckInResource.php b/backend/app/Resources/CheckInList/AttendeeCheckInResource.php
new file mode 100644
index 000000000..15246015f
--- /dev/null
+++ b/backend/app/Resources/CheckInList/AttendeeCheckInResource.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace HiEvents\Resources\CheckInList;
+
+use HiEvents\DomainObjects\AttendeeCheckInDomainObject;
+use Illuminate\Http\Resources\Json\JsonResource;
+
+/**
+ * @mixin AttendeeCheckInDomainObject
+ */
+class AttendeeCheckInResource extends JsonResource
+{
+ public function toArray($request): array
+ {
+ return [
+ 'id' => $this->getId(),
+ 'attendee_id' => $this->getAttendeeId(),
+ 'check_in_list_id' => $this->getCheckInListId(),
+ 'ticket_id' => $this->getTicketId(),
+ 'event_id' => $this->getEventId(),
+ 'short_id' => $this->getShortId(),
+ 'created_at' => $this->getCreatedAt(),
+ ];
+ }
+}
diff --git a/frontend/src/api/check-in.client.ts b/frontend/src/api/check-in.client.ts
index d932e52a6..98765ea49 100644
--- a/frontend/src/api/check-in.client.ts
+++ b/frontend/src/api/check-in.client.ts
@@ -1,11 +1,10 @@
import {publicApi} from "./public-client";
import {
Attendee,
- CheckIn,
CheckInList,
GenericDataResponse,
GenericPaginatedResponse,
- IdParam,
+ IdParam, PublicCheckIn,
QueryFilters,
} from "../types";
import {queryParamsHelper} from "../utilites/queryParamsHelper";
@@ -20,13 +19,13 @@ export const publicCheckInClient = {
return response.data;
},
createCheckIn: async (checkInListShortId: IdParam, attendeePublicId: IdParam) => {
- const response = await publicApi.post<GenericDataResponse<CheckIn[]>>(`/check-in-lists/${checkInListShortId}/check-ins`, {
+ const response = await publicApi.post<GenericDataResponse<PublicCheckIn[]>>(`/check-in-lists/${checkInListShortId}/check-ins`, {
"attendee_public_ids": [attendeePublicId],
});
return response.data;
},
deleteCheckIn: async (checkInListShortId: IdParam, checkInShortId: IdParam) => {
- const response = await publicApi.delete<GenericDataResponse<CheckIn>>(`/check-in-lists/${checkInListShortId}/check-ins/${checkInShortId}`);
+ const response = await publicApi.delete<GenericDataResponse<PublicCheckIn>>(`/check-in-lists/${checkInListShortId}/check-ins/${checkInShortId}`);
return response.data;
},
};
diff --git a/frontend/src/components/common/AttendeeDetails/index.tsx b/frontend/src/components/common/AttendeeDetails/index.tsx
index b15acff75..414bca713 100644
--- a/frontend/src/components/common/AttendeeDetails/index.tsx
+++ b/frontend/src/components/common/AttendeeDetails/index.tsx
@@ -38,7 +38,7 @@ export const AttendeeDetails = ({attendee}: { attendee: Attendee }) => {
{t`Checked In`}
</div>
<div className={classes.amount}>
- {attendee.checked_in_at ? t`Yes` : t`No`}
+ {attendee.check_in ? t`Yes` : t`No`}
</div>
</div>
<div className={classes.block}>
@@ -59,4 +59,4 @@ export const AttendeeDetails = ({attendee}: { attendee: Attendee }) => {
</div>
</Card>
);
-}
\ No newline at end of file
+}
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 771fe42ba..82e8b881d 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -345,7 +345,19 @@ export interface Attendee {
checked_in_by?: number;
question_answers?: QuestionAnswer[];
locale?: SupportedLocales;
- check_in?: CheckIn;
+ check_in?: AttendeeCheckIn;
+}
+
+export type PublicCheckIn = Pick<AttendeeCheckIn, 'id' | 'attendee_id' | 'check_in_list_id' | 'ticket_id' | 'event_id'>;
+
+export interface AttendeeCheckIn {
+ id: IdParam;
+ attendee_id: IdParam;
+ check_in_list_id: IdParam;
+ ticket_id: IdParam;
+ event_id: IdParam;
+ short_id: IdParam;
+ created_at: string;
}
export interface Address {
@@ -475,14 +487,6 @@ export type CheckInListRequest =
ticket_ids: IdParam[];
};
-export interface CheckIn {
- id: number;
- short_id: string;
- check_in_list_id: number;
- attendee_id: number;
- checked_in_at: string;
-}
-
export interface QuestionRequestData {
title: string;
description?: string;