Pfadauswahl hinzugefügt

This commit is contained in:
PxlLoewe
2025-06-25 21:06:03 -07:00
parent 7ad75bff63
commit 2bd8a455c8
14 changed files with 253 additions and 90 deletions

View File

@@ -1,6 +1,6 @@
import { getServerSession } from "../../api/auth/[...nextauth]/auth";
import { prisma } from "@repo/db";
import { KursItem } from "../events/_components/item";
import { EventCard } from "../events/_components/item";
import { RocketIcon } from "lucide-react";
import { eventCompleted } from "../../../helper/events";
@@ -15,15 +15,15 @@ const page = async () => {
const events = await prisma.event.findMany({
where: {
type: "OBLIGATED_COURSE",
type: "EVENT",
},
include: {
participants: {
Participants: {
where: {
userId: user.id,
},
},
appointments: {
Appointments: {
include: {
Participants: {
where: {
@@ -36,12 +36,10 @@ const page = async () => {
});
const filteredEvents = events.filter((event) => {
const userParticipant = event.participants.find(
const userParticipant = event.Participants.find(
(participant) => participant.userId === user.id,
);
if (eventCompleted(event, userParticipant)) return false;
if (event.type === "OBLIGATED_COURSE" && !eventCompleted(event, event.participants[0]))
return true;
return false;
});
@@ -56,9 +54,9 @@ const page = async () => {
<div className="grid grid-cols-6 gap-4">
{filteredEvents.map((event) => {
return (
<KursItem
appointments={event.appointments}
selectedAppointments={event.appointments.filter((a) =>
<EventCard
appointments={event.Appointments}
selectedAppointments={event.Appointments.filter((a) =>
a.Participants.find((p) => p.userId == user.id),
)}
user={user}