fix(series): report created races, delete a series with its races; group Race Day sessions by today's races (1.43.1)
This commit is contained in:
1 parent
74dbbf6ae0
commit
dbda06d101
10 files changed
+133
-13
No files matched your search
+8
-2
@@ -143,7 +143,7 @@ function renderStandingsTable(table, { t, escapeHtml }) {
|
||||
export function renderSeriesView(deps) {
|
||||
const {
|
||||
state, dom, t, escapeHtml, saveState, renderView, uid, getClassName, getSeriesStandings, createSeriesEvents, getRaceFormatPresets, exportSeriesPdf, printSeries,
|
||||
getSeriesRounds, setSeriesRoundFormat, setSeriesRoundParticipants, copySeriesRoundParticipants, addDriverToSeriesRound, generateSeriesRoundQualifying, generateSeriesRoundFinals, openSeriesRound,
|
||||
getSeriesRounds, deleteSeriesRaces, setSeriesRoundFormat, setSeriesRoundParticipants, copySeriesRoundParticipants, addDriverToSeriesRound, generateSeriesRoundQualifying, generateSeriesRoundFinals, openSeriesRound,
|
||||
} = deps;
|
||||
const list = state.series || [];
|
||||
if (!list.some((item) => item.id === selectedSeriesId)) selectedSeriesId = list[0]?.id || "";
|
||||
@@ -241,7 +241,11 @@ export function renderSeriesView(deps) {
|
||||
}));
|
||||
document.getElementById("seriesDelete")?.addEventListener("click", () => {
|
||||
if (!window.confirm(t("series.delete_confirm", { name: series.name }))) return;
|
||||
// The rounds are ordinary races: ask separately, so results can be kept for the archive.
|
||||
const raceCount = rounds.length;
|
||||
const removeRaces = raceCount > 0 && window.confirm(t("series.delete_races_confirm", { count: raceCount }));
|
||||
state.series = list.filter((item) => item.id !== series.id);
|
||||
if (removeRaces) deleteSeriesRaces(series);
|
||||
saveState();
|
||||
renderView();
|
||||
});
|
||||
@@ -251,7 +255,7 @@ export function renderSeriesView(deps) {
|
||||
const dates = String(data.get("dates") || "").split(/[\s,;]+/).map((value) => value.trim()).filter((value) => /^\d{4}-\d{2}-\d{2}$/.test(value));
|
||||
if (!dates.length) { window.alert(t("series.create_dates_invalid")); return; }
|
||||
const seedMethod = String(data.get("seedMethod") || "consecutive");
|
||||
createSeriesEvents(series, dates, String(data.get("presetId") || "custom"), {
|
||||
const created = createSeriesEvents(series, dates, String(data.get("presetId") || "custom"), {
|
||||
qualifyingRounds: data.get("qualifyingRounds"), finalLegs: data.get("finalLegs"), carsPerHeat: data.get("carsPerHeat"),
|
||||
}, {
|
||||
heatOrder: String(data.get("heatOrder") || "fastest_last"),
|
||||
@@ -262,6 +266,8 @@ export function renderSeriesView(deps) {
|
||||
seedMethod: seedMethod === "best_lap" ? "best_sum" : seedMethod,
|
||||
});
|
||||
renderView();
|
||||
// Always say what happened: clicking again for dates already in the series creates nothing.
|
||||
window.alert(created ? t("series.created_rounds", { count: created }) : t("series.created_none"));
|
||||
});
|
||||
// Picking a format fills the round numbers it defines (they can still be changed before creating).
|
||||
const createForm = document.getElementById("seriesCreateEvents");
|
||||
|
||||
Reference in new issue
Block a user