Refactor EventFight handling to include team relation names and update type definitions
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2025-09-28 14:11:58 +02:00
parent c0f4a852b5
commit b11534490d
3 changed files with 27 additions and 11 deletions

View File

@@ -20,9 +20,9 @@
import { Checkbox } from "@components/ui/checkbox";
import { renderComponent } from "@components/ui/data-table";
import type { ColumnDef } from "@tanstack/table-core";
import type { EventFight } from "@type/event.ts";
import type { EventFightModel } from "./eventmodel.svelte";
export const columns: ColumnDef<EventFight> = [
export const columns: ColumnDef<EventFightModel>[] = [
{
id: "auswahl",
header: ({ table }) => {
@@ -32,7 +32,7 @@ export const columns: ColumnDef<EventFight> = [
onCheckedChange: () => {
if (!table.getIsSomeRowsSelected() && !table.getIsAllRowsSelected()) {
const now = new Date();
const rows = table.getRowModel().rows.filter((row) => new Date(row.original.date) > now);
const rows = table.getRowModel().rows.filter((row) => new Date(row.original.start) > now);
if (rows.length > 0) {
rows.forEach((row) => {
@@ -57,7 +57,7 @@ export const columns: ColumnDef<EventFight> = [
},
},
{
accessorFn: (r) => r.blueTeam.name + " vs " + r.redTeam.name,
accessorFn: (r) => r.blueTeam.nameWithRelation + " vs " + r.redTeam.nameWithRelation,
id: "begegnung",
header: "Begegnung",
},