This commit is contained in:
parent
07de342fc2
commit
35fe877d58
32 changed files with 3822 additions and 200 deletions
|
|
@ -15,6 +15,7 @@ export { labelFromFileName, normalizeImageAnnotationData } from "./modules/image
|
|||
export { hostnameFromUrl, normalizeLinksData, normalizeUrl } from "./modules/links.js";
|
||||
export { normalizeMemosData } from "./modules/memos.js";
|
||||
export { normalizeNotepadData, sanitizeNotepadHtml } from "./modules/notepad.js";
|
||||
export { normalizeRandomizerData } from "./modules/randomizer.js";
|
||||
export { uid } from "./modules/shared.js";
|
||||
export { normalizeTableData } from "./modules/table.js";
|
||||
export { normalizeTaskPlannerData } from "./modules/taskPlanner.js";
|
||||
|
|
@ -216,6 +217,27 @@ function remapModuleDataForExport(type, data, nextId) {
|
|||
return { counters: compact.counters.map((counter) => ({ ...counter, id: nextId("counter") })) };
|
||||
}
|
||||
|
||||
if (type === "randomizer") {
|
||||
const remapped = { ...compact };
|
||||
if (compact.wheel?.entries) remapped.wheel = { ...compact.wheel, entries: compact.wheel.entries.map((entry) => ({ ...entry, id: nextId("randomizer") })) };
|
||||
if (compact.teams?.players) {
|
||||
const playerIdMap = new Map(compact.teams.players.map((player) => [player.id, nextId("randomizer")]));
|
||||
remapped.teams = {
|
||||
...compact.teams,
|
||||
players: compact.teams.players.map((player) => ({ ...player, id: playerIdMap.get(player.id) })),
|
||||
exclusions: (compact.teams.exclusions || []).map((exclusion) => ({
|
||||
...exclusion,
|
||||
id: nextId("randomizer"),
|
||||
playerAId: playerIdMap.get(exclusion.playerAId),
|
||||
playerBIds: (exclusion.playerBIds || [exclusion.playerBId])
|
||||
.map((playerId) => playerIdMap.get(playerId))
|
||||
.filter(Boolean)
|
||||
})).filter((exclusion) => exclusion.playerAId && exclusion.playerBIds.length)
|
||||
};
|
||||
}
|
||||
return remapped;
|
||||
}
|
||||
|
||||
if (type === "memos") {
|
||||
const remapped = {};
|
||||
if (compact.tickerEnabled === false) remapped.tickerEnabled = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue