From 8b6abd3f8fe0d663dea74d2fd6e3acaa9d99ed98 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 25 Nov 2023 15:59:42 +1000 Subject: [PATCH] Switch FSRS reschedule to a global option; don't persist A global is easier to use in conjunction with the 'optimize all' action. The value is no longer persisted, as doing so makes it too easy for users to generate a lot of revlog entries when playing with different FSRS weights/retention settings, such as in https://forums.ankiweb.net/t/possible-syncing-limitation-by-fsrs-manual-scheduling-data-accumulation/37610 --- ftl/core/deck-config.ftl | 5 ++++- proto/anki/deck_config.proto | 4 +++- rslib/src/deckconfig/mod.rs | 1 - rslib/src/deckconfig/schema11.rs | 6 ------ rslib/src/deckconfig/service.rs | 1 + rslib/src/deckconfig/update.rs | 4 +++- ts/deck-options/FsrsOptions.svelte | 5 +++-- ts/deck-options/lib.ts | 2 ++ 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ftl/core/deck-config.ftl b/ftl/core/deck-config.ftl index 2a699c9b5..b21ba3016 100644 --- a/ftl/core/deck-config.ftl +++ b/ftl/core/deck-config.ftl @@ -384,10 +384,13 @@ deck-config-reschedule-cards-on-change-tooltip = This option controls whether the due dates of cards will be changed when you enable FSRS, or optimize the parameters. The default is not to reschedule cards: future reviews will use the new scheduling, but there will be no immediate change to your workload. If rescheduling is enabled, the due dates of cards - will be changed. + will be changed. This option is shared by all deck presets, and not saved. deck-config-reschedule-cards-warning = Depending on your desired retention, this can result in a large number of cards becoming due, so is not recommended when first switching from SM2. + + Use this option sparingly, as it will add a review entry to each of your cards, and + increase the size of your collection. deck-config-compute-optimal-weights-tooltip = Once you've done 1000+ reviews in Anki, you can use the Optimize button to analyze your review history, and automatically generate parameters that are optimal for your memory and the content you're studying. diff --git a/proto/anki/deck_config.proto b/proto/anki/deck_config.proto index fdbdee581..43b3429a0 100644 --- a/proto/anki/deck_config.proto +++ b/proto/anki/deck_config.proto @@ -152,7 +152,8 @@ message DeckConfig { // for fsrs float desired_retention = 37; - bool reschedule_fsrs_cards = 39; + // used for fsrs_reschedule in the past + reserved 39; float sm2_retention = 40; string weight_search = 45; @@ -218,4 +219,5 @@ message UpdateDeckConfigsRequest { bool new_cards_ignore_review_limit = 7; bool fsrs = 8; bool apply_all_parent_limits = 9; + bool fsrs_reschedule = 10; } diff --git a/rslib/src/deckconfig/mod.rs b/rslib/src/deckconfig/mod.rs index 436acb238..6fab45db4 100644 --- a/rslib/src/deckconfig/mod.rs +++ b/rslib/src/deckconfig/mod.rs @@ -75,7 +75,6 @@ const DEFAULT_DECK_CONFIG_INNER: DeckConfigInner = DeckConfigInner { fsrs_weights: vec![], desired_retention: 0.9, other: Vec::new(), - reschedule_fsrs_cards: false, sm2_retention: 0.9, weight_search: String::new(), }; diff --git a/rslib/src/deckconfig/schema11.rs b/rslib/src/deckconfig/schema11.rs index 77dde6b5e..b4ca15c43 100644 --- a/rslib/src/deckconfig/schema11.rs +++ b/rslib/src/deckconfig/schema11.rs @@ -84,8 +84,6 @@ pub struct DeckConfSchema11 { #[serde(default = "wait_for_audio_default")] wait_for_audio: bool, #[serde(default)] - reschedule_fsrs_cards: bool, - #[serde(default)] sm2_retention: f32, #[serde(default)] weight_search: String, @@ -294,7 +292,6 @@ impl Default for DeckConfSchema11 { bury_interday_learning: false, fsrs_weights: vec![], desired_retention: 0.9, - reschedule_fsrs_cards: false, sm2_retention: 0.9, weight_search: "".to_string(), } @@ -372,7 +369,6 @@ impl From for DeckConfig { bury_interday_learning: c.bury_interday_learning, fsrs_weights: c.fsrs_weights, desired_retention: c.desired_retention, - reschedule_fsrs_cards: c.reschedule_fsrs_cards, sm2_retention: c.sm2_retention, weight_search: c.weight_search, other: other_bytes, @@ -479,7 +475,6 @@ impl From for DeckConfSchema11 { bury_interday_learning: i.bury_interday_learning, fsrs_weights: i.fsrs_weights, desired_retention: i.desired_retention, - reschedule_fsrs_cards: i.reschedule_fsrs_cards, sm2_retention: i.sm2_retention, weight_search: i.weight_search, } @@ -510,7 +505,6 @@ static RESERVED_DECKCONF_KEYS: Set<&'static str> = phf_set! { "secondsToShowAnswer", "answerAction", "waitForAudio", - "rescheduleFsrsCards", "sm2Retention", "weightSearch", }; diff --git a/rslib/src/deckconfig/service.rs b/rslib/src/deckconfig/service.rs index 58ca25115..5501c800d 100644 --- a/rslib/src/deckconfig/service.rs +++ b/rslib/src/deckconfig/service.rs @@ -105,6 +105,7 @@ impl From for UpdateDeckConfi new_cards_ignore_review_limit: c.new_cards_ignore_review_limit, apply_all_parent_limits: c.apply_all_parent_limits, fsrs: c.fsrs, + fsrs_reschedule: c.fsrs_reschedule, } } } diff --git a/rslib/src/deckconfig/update.rs b/rslib/src/deckconfig/update.rs index b501d0577..0ee29c88f 100644 --- a/rslib/src/deckconfig/update.rs +++ b/rslib/src/deckconfig/update.rs @@ -34,6 +34,7 @@ pub struct UpdateDeckConfigsRequest { pub new_cards_ignore_review_limit: bool, pub apply_all_parent_limits: bool, pub fsrs: bool, + pub fsrs_reschedule: bool, } impl Collection { @@ -241,7 +242,7 @@ impl Collection { weights: c.inner.fsrs_weights.clone(), desired_retention: c.inner.desired_retention, max_interval: c.inner.maximum_review_interval, - reschedule: c.inner.reschedule_fsrs_cards, + reschedule: req.fsrs_reschedule, sm2_retention: c.inner.sm2_retention, }) } else { @@ -434,6 +435,7 @@ mod test { new_cards_ignore_review_limit: false, apply_all_parent_limits: false, fsrs: false, + fsrs_reschedule: false, }; assert!(!col.update_deck_configs(input.clone())?.changes.had_change()); diff --git a/ts/deck-options/FsrsOptions.svelte b/ts/deck-options/FsrsOptions.svelte index 7821b0121..8bb31a720 100644 --- a/ts/deck-options/FsrsOptions.svelte +++ b/ts/deck-options/FsrsOptions.svelte @@ -32,6 +32,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const config = state.currentConfig; const defaults = state.defaults; + const fsrsReschedule = state.fsrsReschedule; let computeWeightsProgress: ComputeWeightsProgress | undefined; let computingWeights = false; @@ -264,13 +265,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
- + openHelpModal("rescheduleCardsOnChange")}> {tr.deckConfigRescheduleCardsOnChange()} - {#if $config.rescheduleFsrsCards} + {#if $fsrsReschedule} {/if}
diff --git a/ts/deck-options/lib.ts b/ts/deck-options/lib.ts index d485c2e9e..856ebc903 100644 --- a/ts/deck-options/lib.ts +++ b/ts/deck-options/lib.ts @@ -44,6 +44,7 @@ export class DeckOptionsState { readonly newCardsIgnoreReviewLimit: Writable; readonly applyAllParentLimits: Writable; readonly fsrs: Writable; + readonly fsrsReschedule: Writable = writable(false); readonly currentPresetName: Writable; private targetDeckId: DeckOptionsId; @@ -204,6 +205,7 @@ export class DeckOptionsState { newCardsIgnoreReviewLimit: get(this.newCardsIgnoreReviewLimit), applyAllParentLimits: get(this.applyAllParentLimits), fsrs: get(this.fsrs), + fsrsReschedule: get(this.fsrsReschedule), }; }