This commit is contained in:
larssand
2026-03-27 19:35:05 +01:00
parent f5be5b57ad
commit 346eb41e75
2 changed files with 16 additions and 13 deletions

View File

@@ -514,8 +514,12 @@ export function renderEventManagerView(context) {
}
const form = new FormData(formNode);
const name = String(form.get("teamName") || "").trim();
const driverIds = form.getAll("teamDriverIds").map(String).filter(Boolean);
const carIds = form.getAll("teamCarIds").map(String).filter(Boolean);
const driverIds = Array.from(document.querySelectorAll('[form="teamForm"][name="teamDriverIds"]:checked'))
.map((node) => String(node.value))
.filter(Boolean);
const carIds = Array.from(document.querySelectorAll('[form="teamForm"][name="teamCarIds"]:checked'))
.map((node) => String(node.value))
.filter(Boolean);
if (!name) {
setFormError("teamCreateError", t("validation.required_name"));
return;
@@ -581,8 +585,12 @@ export function renderEventManagerView(context) {
}
const form = new FormData(formNode);
const name = String(form.get("teamName") || "").trim();
const driverIds = form.getAll("teamDriverIds").map(String).filter(Boolean);
const carIds = form.getAll("teamCarIds").map(String).filter(Boolean);
const driverIds = Array.from(formNode.querySelectorAll('[name="teamDriverIds"]:checked'))
.map((node) => String(node.value))
.filter(Boolean);
const carIds = Array.from(formNode.querySelectorAll('[name="teamCarIds"]:checked'))
.map((node) => String(node.value))
.filter(Boolean);
if (!name) {
setFormError("teamEditError", t("validation.required_name"));
return;

View File

@@ -509,15 +509,10 @@ export function getEventTeams(event, { normalizeRaceTeam }) {
export function getTeamDriverPool(event, { getEventDrivers, state }) {
const classDrivers = state.drivers.filter((driver) => !event?.classId || driver.classId === event.classId);
if (classDrivers.length) {
return { drivers: classDrivers, fallback: false };
}
const scopedDrivers = getEventDrivers(event);
if (scopedDrivers.length) {
return { drivers: scopedDrivers, fallback: false };
}
return { drivers: [], fallback: false };
return {
drivers: Array.isArray(state?.drivers) ? [...state.drivers] : [],
fallback: false,
};
}