This commit is contained in:
nocnico
2025-03-11 19:21:07 +01:00
parent 638c561211
commit f9706edc10
4 changed files with 10 additions and 12 deletions

View File

@@ -94,22 +94,21 @@ const ModalBtn = ({
date.id === selectAppointmentForm.watch("eventAppointmentId") ||
selectedAppointment?.id,
);
const ownIndexInParticipantList =
(selectedDate as any)?.Participants?.findIndex(
(p: Participant) => p.userId === user.id,
) || (selectedDate as any)?.Participants?.length + 1;
const ownIndexInParticipantList = (
selectedDate as any
)?.Participants?.findIndex((p: Participant) => p.userId === user.id);
const ownPlaceInParticipantList =
ownIndexInParticipantList === -1
? (selectedDate as any)?.Participants?.length + 1
: ownIndexInParticipantList + 1;
console.log(
console.log({
selectedDate,
ownPlaceInParticipantList > event.maxParticipants!,
ownPlaceInParticipantList,
event.maxParticipants,
);
ownIndexInParticipantList,
maxParticipants: event.maxParticipants,
});
return (
<>