diff --git a/src/Mealz/MealBundle/Controller/EventController.php b/src/Mealz/MealBundle/Controller/EventController.php index 65b4b68a9..b6911c9e0 100644 --- a/src/Mealz/MealBundle/Controller/EventController.php +++ b/src/Mealz/MealBundle/Controller/EventController.php @@ -110,7 +110,7 @@ public function join(DateTime $date, int $eventId): JsonResponse if (new DateTime() > $day->getDateTime()->modify($eventLockModifier)) { return new JsonResponse(['message' => '804: User could not join the event'], Response::HTTP_INTERNAL_SERVER_ERROR); } - + // var_dump($day->getDateTime()); exit; $eventParticipation = $this->eventPartSrv->join($profile, $day, $eventId); if (null === $eventParticipation) { return new JsonResponse(['message' => '802: User could not join the event'], Response::HTTP_INTERNAL_SERVER_ERROR); diff --git a/src/Mealz/MealBundle/Entity/Day.php b/src/Mealz/MealBundle/Entity/Day.php index 97c6cbdfd..520ee07ef 100644 --- a/src/Mealz/MealBundle/Entity/Day.php +++ b/src/Mealz/MealBundle/Entity/Day.php @@ -88,9 +88,9 @@ public function getEvents(): EventCollection } - public function getEvent(Day $day, int $id):EventParticipation | null{ + public function getEvent(int $id):EventParticipation | null{ foreach ($this->getEvents() as $event) { - if($event->getId() === $id && $event->getDay() === $day){ + if($event->getId() === $id){ return $event; } } diff --git a/src/Mealz/MealBundle/Service/EventParticipationService.php b/src/Mealz/MealBundle/Service/EventParticipationService.php index 411d8728a..cd368f113 100644 --- a/src/Mealz/MealBundle/Service/EventParticipationService.php +++ b/src/Mealz/MealBundle/Service/EventParticipationService.php @@ -60,7 +60,7 @@ public function getEventParticipationData(Day $day, ?int $eventId = null, ?Profi if($eventId === null){ return $day->getEvents()->toArray(); } else{ - $eventParticipation = $day->getEvent($day,$eventId); + $eventParticipation = $day->getEvent($eventId); if (null === $eventParticipation) { return null; } @@ -81,7 +81,7 @@ public function getEventParticipationData(Day $day, ?int $eventId = null, ?Profi public function join(Profile $profile, Day $day, int $eventId): ?EventParticipation { - $eventParticipation = $day->getEvent($day, $eventId); + $eventParticipation = $day->getEvent($eventId); if (null !== $eventParticipation && true === $this->doorman->isUserAllowedToJoinEvent($eventParticipation)) { $participation = $this->createEventParticipation($profile, $eventParticipation); $this->em->persist($participation); @@ -115,7 +115,7 @@ public function joinAsGuest( try { $this->em->persist($guestProfile); - $eventParticipation = $eventDay->getEvent($eventDay, $eventId); + $eventParticipation = $eventDay->getEvent($eventId); $participation = $this->createEventParticipation($guestProfile, $eventParticipation); $this->em->persist($participation); @@ -132,7 +132,7 @@ public function joinAsGuest( public function leave(Profile $profile, Day $day, int $eventId): ?EventParticipation { - $eventParticipation = $day->getEvent($day, $eventId); + $eventParticipation = $day->getEvent( $eventId); $participation = $eventParticipation->getParticipant($profile); if (null !== $participation) { @@ -152,14 +152,14 @@ public function leave(Profile $profile, Day $day, int $eventId): ?EventParticipa */ public function getParticipants(Day $day, int $eventId): array { - $eventParticipation = $day->getEvent($day, $eventId); + $eventParticipation = $day->getEvent($eventId); if (null === $eventParticipation) { return []; } return array_map( fn (Participant $participant) => $this->getParticipantName($participant), - $day->getEvent($day, $eventId)->getParticipants()->toArray() + $day->getEvent( $eventId)->getParticipants()->toArray() ); } diff --git a/src/Resources/src/api/getDashboardData.ts b/src/Resources/src/api/getDashboardData.ts index 8d7032fd2..40e292b8e 100644 --- a/src/Resources/src/api/getDashboardData.ts +++ b/src/Resources/src/api/getDashboardData.ts @@ -40,9 +40,7 @@ export type Slot = { }; export type EventParticipation = { - id: number; - event: Event; - day: Date; + eventId: number; participationId: number; participations: number; isParticipating: boolean; diff --git a/src/Resources/src/api/postJoinEvent.ts b/src/Resources/src/api/postJoinEvent.ts index c30c58175..e1e1082ac 100644 --- a/src/Resources/src/api/postJoinEvent.ts +++ b/src/Resources/src/api/postJoinEvent.ts @@ -13,8 +13,6 @@ export default async function postJoinEvent(date: string, eventId: number) { 'POST', `api/events/participation/${date}/${eventId}` ); - await request(); - return { error, response }; } diff --git a/src/Resources/src/components/dashboard/EventData.vue b/src/Resources/src/components/dashboard/EventData.vue index fd592bf03..b47f8b308 100644 --- a/src/Resources/src/components/dashboard/EventData.vue +++ b/src/Resources/src/components/dashboard/EventData.vue @@ -28,11 +28,11 @@ - {{ getEventById(event?.id ?? -1)?.title }} + {{ getEventById(event?.eventId ?? -1)?.title }}
event.id === eventId); } @@ -189,9 +189,7 @@ export function useEvents() { * @param date The date the event is on (format: 'YYYY-mm-dd hh:MM:ss') */ async function joinEvent(date: string, eventId: number) { - console.log('Join event im EventStore ' + eventId); const { error, response } = await postJoinEvent(date, eventId); - if (error.value === true && isMessage(response.value) === true) { EventsState.error = (response.value as IMessage)?.message; } else if (error.value === true) {