diff --git a/ts/deck-options/FsrsOptions.svelte b/ts/deck-options/FsrsOptions.svelte index 448b5460d..c0f6d377e 100644 --- a/ts/deck-options/FsrsOptions.svelte +++ b/ts/deck-options/FsrsOptions.svelte @@ -30,7 +30,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const defaults = state.defaults; let computeWeightsProgress: ComputeWeightsProgress | undefined; - let computing = false; + let computingWeights = false; + let checkingWeights = false; + let computingRetention = false; + $: computing = computingWeights || checkingWeights || computingRetention; $: customSearch = `preset:"${$presetName}"`; let computeRetentionProgress: @@ -47,11 +50,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html optimalRetentionRequest.daysToSimulate = 3650; } async function computeWeights(): Promise { - if (computing) { + if (computingWeights) { await setWantsAbort({}); return; } - computing = true; + computingWeights = true; try { await runWithBackendProgress( async () => { @@ -76,16 +79,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html }, ); } finally { - computing = false; + computingWeights = false; } } async function checkWeights(): Promise { - if (computing) { + if (checkingWeights) { await setWantsAbort({}); return; } - computing = true; + checkingWeights = true; try { await runWithBackendProgress( async () => { @@ -116,16 +119,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html }, ); } finally { - computing = false; + checkingWeights = false; } } async function computeRetention(): Promise { - if (computing) { + if (computingRetention) { await setWantsAbort({}); return; } - computing = true; + computingRetention = true; try { await runWithBackendProgress( async () => { @@ -150,7 +153,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html }, ); } finally { - computing = false; + computingRetention = false; } } @@ -205,26 +208,28 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {tr.deckConfigComputeOptimalWeights()} - {#if computing}
{computeWeightsProgressString}
{/if} + {#if checkingWeights}
{computeWeightsProgressString}
{/if} @@ -251,10 +256,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html