diff --git a/frontend/src/Editor.svelte b/frontend/src/Editor.svelte index 42f19f6..7a53067 100644 --- a/frontend/src/Editor.svelte +++ b/frontend/src/Editor.svelte @@ -8,6 +8,8 @@ import TaskDisplay from "./TaskDisplay.svelte"; import TaskDetailEditor from "./TaskDetailEditor.svelte"; import { forceSimulation } from "./force-simulation"; + import { refresh as refreshTaskStatuses, taskStatuses } from './task-status-cache' +import { isLoggedIn } from "./ksp-task-grabber"; export let tasks: TasksFile; @@ -155,6 +157,26 @@ tasks = tasks; } } + + async function loadYear() { + if (!isLoggedIn()) { + alert("Musíš se přihlásit") + return + } + const y = prompt("Který ročník (číslo 26...X)") + await refreshTaskStatuses([`${y}-Z1-1`]) + const newTasks = Array.from($taskStatuses.values()).filter(t => t.id.startsWith(y + "-") && !tasks.tasks.find(tt => tt.type == "open-data" && tt.taskReference == t.id)) + const newDescriptors: TaskDescriptor[] = + newTasks.map(t => ({ + type: "open-data", + id: t.id, + taskReference: t.id, + requires: [], + position: [0, 0], + title: t.name + })) + tasks.tasks = [...tasks.tasks, ...newDescriptors] + }