// "Series" page: create a series/cup, pick its classes and races (or create the races in one // go from a list of dates), set the points table and how many results count, and follow the // standings per class - printable and exportable as PDF. Scoring lives in series_logic.js. import { SERIES_POINT_PRESETS, normalizeSeries, parsePointsTable } from "./series_logic.js"; let selectedSeriesId = ""; function presetIdFor(series) { return Object.entries(SERIES_POINT_PRESETS).find(([, preset]) => preset.table.join(",") === series.pointsTable.join(",") && preset.step === series.pointsStep && preset.min === series.pointsMin)?.[0] || "custom"; } const byName = (a, b) => String(a.name || "").localeCompare(String(b.name || ""), undefined, { numeric: true, sensitivity: "base" }); // Steps 1 and 2 are one form: every change is saved straight away (no Save button to forget). function renderSeriesForm(series, { t, escapeHtml, state }) { const clubs = [...new Set(state.drivers.map((driver) => String(driver.club || "").trim()).filter(Boolean))].sort(); const presetId = presetIdFor(series); const classes = state.classes.slice().sort(byName); return `
`; } let expandedRoundId = ""; function renderRoundParticipants(round, { t, escapeHtml }) { return `${t("series.no_class_drivers")}
`}${t("series.no_rounds")}
`; const number = (round, name, value, min) => ``; return `| ${t("series.col_date")} | ${t("series.col_race")} | ${t("series.col_drivers")} | ${t("series.col_qual_short")} | ${t("series.col_finals")} | ${t("series.col_per_heat")} | ${t("series.col_status")} | |
|---|---|---|---|---|---|---|---|
| ${escapeHtml(round.event.date || t("series.no_date"))} | ${escapeHtml(round.event.name)} ${escapeHtml(round.className)} |
${number(round, "qualifyingRounds", config.qualifyingRounds || 1, 1)} | ${number(round, "finalLegs", config.finalLegs || 1, 1)} | ${number(round, "carsPerHeat", config.carsPerHeat || 8, 2)} | ${t(`series.status_${round.status}`)}${round.qualHeatCount ? ` ${t("series.heats_made", { heats: round.qualHeatCount })}` : ""} |
${action} |
|
| ${renderRoundParticipants(round, { t, escapeHtml })} | |||||||
| ${t("table.pos")} | ${t("table.driver")} | ${head}${t("series.starts")} | ${t("series.total")} |
|---|---|---|---|
| ${row.rank} | ${escapeHtml(row.driverName)} | ${cells(row)}${row.starts} | ${row.total} |
${t("series.no_results")}
`}${t("series.hint")}
${t("series.none")}
`}${t("series.events_hint")}
${t("series.pick_classes_first")}
`}${t("series.no_results")}
`}${t("series.legend")}