From 7a11710a13fd4400d0d90fa780873b61b0558f86 Mon Sep 17 00:00:00 2001 From: Oliver Braun Date: Sun, 19 Jul 2026 18:56:30 +0200 Subject: [PATCH] fix: don't clear the plan when toggling a student/group selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Checking a student in the onlyFor selection cleared the plan preview (toggleTarget and the alle/keine buttons set plan = null), which was confusing. A run/schedule uses the onlyFor carried by the plan token (the subset it was planned with), not the live checkboxes, so the plan does not need clearing. Now the selection is applied only when you click "Planen"; the shown plan stays, and a small "Auswahl geändert — Planen erneut klicken" hint appears when the selection differs from what was planned. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../[name]/[assignment]/ops/+page.svelte | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/routes/courses/[name]/[assignment]/ops/+page.svelte b/src/routes/courses/[name]/[assignment]/ops/+page.svelte index db7aa6e..993a8b7 100644 --- a/src/routes/courses/[name]/[assignment]/ops/+page.svelte +++ b/src/routes/courses/[name]/[assignment]/ops/+page.svelte @@ -36,14 +36,18 @@ let targets = $derived(data.targets ?? []); let per = $derived(data.per); let selected = $state([]); + // The subset a shown plan was made with; a run/schedule uses this (via the + // token), not the current checkboxes — so checking a box does not clear the plan. + let plannedFor = $state([]); function toggleTarget(t: string) { selected = selected.includes(t) ? selected.filter((x) => x !== t) : [...selected, t]; - plan = null; } let plan = $state(null); let planning = $state(false); let planError = $state(''); + // True when the target selection changed since the shown plan was made. + let planStale = $derived(!!plan && plannedFor.join('\n') !== selected.join('\n')); let confirmPhrase = $state(''); @@ -122,6 +126,7 @@ return; } plan = d.planOp; + plannedFor = [...selected]; } catch (e) { planError = e instanceof Error ? e.message : String(e); } finally { @@ -291,21 +296,13 @@ {selected.length > 0 ? `(${selected.length} ausgewählt)` : '(optional — leer = alle)'}
- (selected = [])} + >keine (selected = [...targets])}>alle
@@ -322,6 +319,12 @@ {/each}
+ {#if planStale} +

+ Auswahl geändert — „Planen" erneut klicken, um sie zu übernehmen. (Der aktuelle Plan + betrifft {plannedFor.length > 0 ? `${plannedFor.length} ausgewählte` : 'alle'}.) +

+ {/if} {/if} {#if planError}