feat(race): driver picker grouped by class with all/none per class, search and copy from an earlier race (1.89.33)
This commit is contained in:
1 parent
eac897c774
commit
cc286165df
17 files changed
+339
-102
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { bindParticipantPicker, participantCopySources } from "./participant_picker.js";
|
||||
import { openHouseOfRcEntryRefresh, openHouseOfRcResultsPost } from "./houseofrc_view.js";
|
||||
import { mountSponsorSetup } from "./sponsor_event_view.js";
|
||||
import { mountTeamRaceSetup } from "./team_race_setup_view.js";
|
||||
@@ -148,6 +149,9 @@ export function renderEventManagerView(context) {
|
||||
const otherClassChoices = event.mode === "race" && event.classId
|
||||
? clubDrivers.filter((driver) => !driver.guestEventId && !participantChoices.includes(driver)).sort((a, b) => String(a.name || "").localeCompare(String(b.name || "")))
|
||||
: [];
|
||||
// Copy the drivers of an earlier race (a cup round) in one go; the series' own rounds first.
|
||||
const seriesEventIds = (state.series || []).filter((series) => (series.eventIds || []).includes(event.id)).flatMap((series) => series.eventIds || []);
|
||||
const copySources = event.mode === "race" ? participantCopySources(state.events, { currentEventId: event.id, seriesEventIds, getDriverIds: (item) => getEventDrivers(item).map((driver) => driver.id) }) : [];
|
||||
const teamDriverPool = event.mode === "race" ? getTeamDriverPool(event) : { drivers: [], fallback: false };
|
||||
const raceTeams = event.mode === "race" ? getEventTeams(event) : [];
|
||||
if (selectedTeamEditId && !raceTeams.some((team) => team.id === selectedTeamEditId)) {
|
||||
@@ -210,6 +214,7 @@ export function renderEventManagerView(context) {
|
||||
raceDrivers,
|
||||
participantChoices,
|
||||
otherClassChoices,
|
||||
participantCopySources: copySources,
|
||||
teamDriverPool,
|
||||
showTeamsSection,
|
||||
parseQualifyingHeatName,
|
||||
@@ -605,8 +610,12 @@ export function renderEventManagerView(context) {
|
||||
refreshManager();
|
||||
};
|
||||
|
||||
document.querySelectorAll(".race-participant").forEach((node) => {
|
||||
node.addEventListener("change", persistRaceParticipants);
|
||||
bindParticipantPicker(document.getElementById("manage-setup-participants"), {
|
||||
onChange: persistRaceParticipants,
|
||||
getCopyIds: (sourceId) => {
|
||||
const source = state.events.find((item) => item.id === sourceId);
|
||||
return source ? getEventDrivers(source).map((driver) => driver.id) : [];
|
||||
},
|
||||
});
|
||||
|
||||
// Race made from House of RC: fetch late entries and withdrawals again.
|
||||
@@ -635,20 +644,6 @@ export function renderEventManagerView(context) {
|
||||
event, overview: getRaceOverview(event), state, t, escapeHtml, saveState,
|
||||
}));
|
||||
|
||||
document.getElementById("selectAllParticipants")?.addEventListener("click", () => {
|
||||
document.querySelectorAll(".race-participant").forEach((node) => {
|
||||
node.checked = true;
|
||||
});
|
||||
persistRaceParticipants();
|
||||
});
|
||||
|
||||
document.getElementById("clearParticipants")?.addEventListener("click", () => {
|
||||
document.querySelectorAll(".race-participant").forEach((node) => {
|
||||
node.checked = false;
|
||||
});
|
||||
persistRaceParticipants();
|
||||
});
|
||||
|
||||
if (showTeamsSection) {
|
||||
mountTeamRaceSetup(document.getElementById("manage-setup-teams"), {
|
||||
event, state, t, escapeHtml, uid, saveState, refresh: refreshManager, getSessionsForEvent, getEventTeams, getTeamDriverPool, normalizeSession, getStatusLabel,
|
||||
|
||||
Reference in new issue
Block a user