diff --git a/ts/routes/deck-options/SimulatorModal.svelte b/ts/routes/deck-options/SimulatorModal.svelte index 84da9213b..4638b6c32 100644 --- a/ts/routes/deck-options/SimulatorModal.svelte +++ b/ts/routes/deck-options/SimulatorModal.svelte @@ -162,11 +162,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html simulating = false; if (resp) { // Clear the graph if transitioning from workload to simulation - if (workload == true) { - points = []; - simulationNumber = 0; - } - workload = false; simulationNumber += 1; const dailyTotalCount = addArrays( @@ -196,7 +191,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } } - async function workloadGraph(): Promise { + async function simulateWorkload(): Promise { let resp: SimulateFsrsWorkloadResponse | undefined; updateRequest(); try { @@ -210,13 +205,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } finally { simulating = false; if (resp) { - // Clear the graph if transitioning from simulation to workload - if (workload == false) { - points = []; - simulationNumber = 0; - } - workload = true; - simulationNumber += 1; points = points.concat( @@ -250,6 +238,29 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html ); } + function saveConfigToPreset() { + if (confirm(tr.deckConfigSaveOptionsToPresetConfirm())) { + $config.newPerDay = simulateFsrsRequest.newLimit; + $config.reviewsPerDay = simulateFsrsRequest.reviewLimit; + $config.maximumReviewInterval = simulateFsrsRequest.maxInterval; + $config.desiredRetention = simulateFsrsRequest.desiredRetention; + $newCardsIgnoreReviewLimit = simulateFsrsRequest.newCardsIgnoreReviewLimit; + $config.reviewOrder = simulateFsrsRequest.reviewOrder; + $config.leechAction = suspendLeeches + ? DeckConfig_Config_LeechAction.SUSPEND + : DeckConfig_Config_LeechAction.TAG_ONLY; + $config.leechThreshold = leechThreshold; + $config.easyDaysPercentages = [...easyDayPercentages]; + onPresetChange(); + } + } + + function switchModes() { + points = []; + simulationNumber = 0; + workload = !workload; + } + $: if (svg) { let pointsToRender = points; if (smooth) { @@ -485,55 +496,51 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/if} - - +
+
+ - + - + +
+

+ {#if workload} + Desired Retention Mode + {:else} + Simulation Mode + {/if} +

+ +
+ +
+
{#if processing} {tr.actionsProcessing()} @@ -656,4 +663,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html summary { margin-bottom: 0.5em; } + + .button-row { + display: grid; + grid-template-columns: 1fr auto 1fr; + } + + .mode-switch { + display: flex; + flex-direction: row-reverse; + }