feat(series): rookie rounds can pick drivers from other classes, with a guide section (1.75.0)
This commit is contained in:
1 parent
bea4283130
commit
d5337e2cf3
11 files changed
+103
-9
No files matched your search
+31
-4
@@ -895,8 +895,19 @@ const getSeriesRounds = (series) => state.events
|
||||
return {
|
||||
event,
|
||||
className: getClassName(event.classId),
|
||||
classDrivers: state.drivers.filter((driver) => driver.classId === event.classId).sort(byDriverName),
|
||||
participantIds: getEventDrivers(event).map((driver) => driver.id),
|
||||
// The class's own drivers plus anyone ticked from another class (a Rookie round mixes
|
||||
// 2WD and 4WD drivers without registering them again); the rest of the club is offered
|
||||
// folded away as otherDrivers.
|
||||
...(() => {
|
||||
const participantIds = getEventDrivers(event).map((driver) => driver.id);
|
||||
const club = state.drivers.filter((driver) => !driver.guestEventId);
|
||||
const roster = club.filter((driver) => driver.classId === event.classId || participantIds.includes(driver.id)).sort(byDriverName);
|
||||
return {
|
||||
participantIds,
|
||||
classDrivers: roster,
|
||||
otherDrivers: club.filter((driver) => !roster.includes(driver)).sort(byDriverName).map((driver) => ({ ...driver, className: getClassName(driver.classId) })),
|
||||
};
|
||||
})(),
|
||||
status: getSeriesRoundStatus(sessions),
|
||||
nextStep: getSeriesRoundNextStep(sessions, event.sessionOrder),
|
||||
qualHeatCount: new Set(qualSessions.map((session) => String(session.name || "").split(" ").pop())).size,
|
||||
@@ -1298,7 +1309,15 @@ const TRANSLATIONS = {
|
||||
"series.round_participants": "Deltagare: {count} av {total} i klassen",
|
||||
"series.copy_previous": "Kopiera från förra",
|
||||
"series.no_previous_round": "Ingen tidigare deltävling i samma klass.",
|
||||
"series.no_class_drivers": "Inga förare i klassen ännu - lägg till nedan.",
|
||||
"series.no_class_drivers": "Inga förare i klassen ännu - välj bland förare från andra klasser eller lägg till en ny nedan.",
|
||||
"series.other_class_hint": "Samma förare och transponder som i sin vanliga klass - inget behöver läggas upp igen. Poängen räknas i den här klassens tabell.",
|
||||
"guide.rookie_title": "Rookie-klass (förare från 2WD/4WD kör eget race)",
|
||||
"guide.rookie_1": "Rookies behöver inte läggas upp igen. De finns redan som förare i t.ex. 2WD eller 4WD och kör rookie-racet med samma förare och transponder. 2WD och 4WD kan blandas i samma rookie-race.",
|
||||
"guide.rookie_2": "1. Klasser: skapa en klass som heter Rookie. Den behöver inga egna förare.",
|
||||
"guide.rookie_3": "2. Eget race (Race Setup): skapa racet med klass Rookie. Under Deltagare fäller du ut Förare från andra klasser och bockar i rookie-förarna.",
|
||||
"guide.rookie_4": "3. Serie/cup: bocka i Rookie under klasser i steg 1 (sparas direkt). Finns serien redan: klistra in samma datum i steg 3 och tryck Skapa deltävlingar - bara de saknade Rookie-deltävlingarna skapas, de som finns rörs inte.",
|
||||
"guide.rookie_5": "4. Varje deltävling: klicka på antalet förare på Rookie-raden, fäll ut Förare från andra klasser och bocka i rookie-förarna. Nästa gång tar Kopiera från förra samma rookies.",
|
||||
"guide.rookie_6": "Rookie får en egen ställning i serien med samma poängtabell, räkneregel (bästa N) och klubbregel som resten av serien. Poängen blandas aldrig med föraren i 2WD/4WD. Racets format, kval, finaler, open practice och min/max varvtid påverkas inte. Rookie-racets varv syns i förarens träningsstatistik.",
|
||||
"series.new_driver_name": "Ny förare - namn",
|
||||
"series.add_driver": "Lägg till",
|
||||
"series.no_rounds": "Inga deltävlingar ännu - skapa dem ovan.",
|
||||
@@ -3425,7 +3444,15 @@ const TRANSLATIONS = {
|
||||
"series.round_participants": "Drivers: {count} of {total} in the class",
|
||||
"series.copy_previous": "Copy from previous",
|
||||
"series.no_previous_round": "No earlier round in the same class.",
|
||||
"series.no_class_drivers": "No drivers in the class yet - add one below.",
|
||||
"series.no_class_drivers": "No drivers in the class yet - pick from drivers in other classes or add a new one below.",
|
||||
"series.other_class_hint": "Same driver and transponder as in their usual class - nothing is registered again. Points count in this class's table.",
|
||||
"guide.rookie_title": "Rookie class (2WD/4WD drivers run their own race)",
|
||||
"guide.rookie_1": "Rookies are not registered again. They already exist as drivers in e.g. 2WD or 4WD and run the rookie race with the same driver and transponder. 2WD and 4WD can be mixed in one rookie race.",
|
||||
"guide.rookie_2": "1. Classes: create a class called Rookie. It needs no drivers of its own.",
|
||||
"guide.rookie_3": "2. A single race (Race Setup): create the race with class Rookie. Under Participants, open Drivers from other classes and tick the rookies.",
|
||||
"guide.rookie_4": "3. Series/cup: tick Rookie under classes in step 1 (saved at once). Series already running: paste the same dates in step 3 and press Create rounds - only the missing Rookie rounds are created, existing ones are left alone.",
|
||||
"guide.rookie_5": "4. Each round: click the driver count on the Rookie row, open Drivers from other classes and tick the rookies. Next time Copy from previous takes the same rookies.",
|
||||
"guide.rookie_6": "Rookie gets its own standings in the series with the same points table, count rule (best N) and club rule as the rest of the series. Points never mix with the driver's 2WD/4WD standings. The race format, qualifying, finals, open practice and min/max lap time are not affected. The rookie race's laps show in the driver's training stats.",
|
||||
"series.new_driver_name": "New driver - name",
|
||||
"series.add_driver": "Add",
|
||||
"series.no_rounds": "No rounds yet - create them above.",
|
||||
|
||||
@@ -114,6 +114,7 @@ export function renderGuideView({ dom, t }) {
|
||||
${renderGuidePanel("guide.series_day_title", ["guide.series_day_1", "guide.series_day_2", "guide.series_day_3", "guide.series_day_4", "guide.series_day_5", "guide.series_day_6"], "", { t })}
|
||||
${renderGuidePanel("guide.series_points_title", ["guide.series_points_1", "guide.series_points_2", "guide.series_points_3", "guide.series_points_4", "guide.series_points_5", "guide.series_points_6"], "", { t })}
|
||||
${renderGuidePanel("guide.series_example_title", ["guide.series_example_1", "guide.series_example_2", "guide.series_example_3", "guide.series_example_4"], "", { t })}
|
||||
${renderGuidePanel("guide.rookie_title", ["guide.rookie_1", "guide.rookie_2", "guide.rookie_3", "guide.rookie_4", "guide.rookie_5", "guide.rookie_6"], "", { t })}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+6
-1
@@ -104,6 +104,10 @@ function renderRoundParticipants(round, { t, escapeHtml }) {
|
||||
${round.classDrivers.length ? `<div class="series-class-list">${round.classDrivers.map((driver) => `
|
||||
<label class="series-class-row ${round.participantIds.includes(driver.id) ? "is-selected" : ""}"><input type="checkbox" data-round-driver="${escapeHtml(driver.id)}" ${round.participantIds.includes(driver.id) ? "checked" : ""} /><span>${escapeHtml(driver.name)}${driver.transponder ? ` <small>${escapeHtml(driver.transponder)}</small>` : ""}</span></label>`).join("")}</div>`
|
||||
: `<p class="hint">${t("series.no_class_drivers")}</p>`}
|
||||
${(round.otherDrivers || []).length ? `<details class="series-other-drivers" ${round.classDrivers.length ? "" : "open"}><summary>${t("events.other_class_participants", { count: round.otherDrivers.length })}</summary>
|
||||
<p class="hint">${t("series.other_class_hint")}</p>
|
||||
<div class="series-class-list">${round.otherDrivers.map((driver) => `
|
||||
<label class="series-class-row"><input type="checkbox" data-round-driver="${escapeHtml(driver.id)}" /><span>${escapeHtml(driver.name)} <small>${escapeHtml(driver.className || "")}${driver.transponder ? ` · ${escapeHtml(driver.transponder)}` : ""}</small></span></label>`).join("")}</div></details>` : ""}
|
||||
<form class="series-add-driver" data-round-add-driver>
|
||||
<input name="name" required placeholder="${escapeHtml(t("series.new_driver_name"))}" />
|
||||
<input name="transponder" placeholder="${escapeHtml(t("drivers.transponder_placeholder"))}" inputmode="numeric" />
|
||||
@@ -397,7 +401,8 @@ export function renderSeriesView(deps) {
|
||||
detail.querySelectorAll("[data-round-driver]").forEach((box) => box.addEventListener("change", () => { setSeriesRoundParticipants(eventId, ticked()); renderView(); }));
|
||||
detail.querySelectorAll("[data-round-action]").forEach((button) => button.addEventListener("click", () => {
|
||||
const action = button.dataset.roundAction;
|
||||
if (action === "all") setSeriesRoundParticipants(eventId, [...detail.querySelectorAll("[data-round-driver]")].map((box) => box.dataset.roundDriver));
|
||||
// "All" means the class's own list, not the folded drivers from other classes.
|
||||
if (action === "all") setSeriesRoundParticipants(eventId, [...detail.querySelectorAll(".series-class-list:not(.series-other-drivers *) [data-round-driver]")].map((box) => box.dataset.roundDriver));
|
||||
if (action === "none") setSeriesRoundParticipants(eventId, []);
|
||||
if (action === "copy" && !copySeriesRoundParticipants(series, eventId)) window.alert(t("series.no_previous_round"));
|
||||
renderView();
|
||||
|
||||
Reference in new issue
Block a user