Feat/Add legacy evaluate config bool (#4149)

* Feat/Add legacy evaluate config bool

* Minor tweaks based on PR suggestions (dae)

New enabling command:

from anki.config import Config
mw.col.set_config_bool(Config.Bool.FSRS_LEGACY_EVALUATE, True)
This commit is contained in:
Luc Mcgrady 2025-07-04 09:32:09 +01:00 committed by GitHub
parent fba1d7b4b0
commit f5285f359a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 12 additions and 6 deletions

View file

@ -56,6 +56,7 @@ message ConfigKey {
RENDER_LATEX = 25;
LOAD_BALANCER_ENABLED = 26;
FSRS_SHORT_TERM_WITH_STEPS_ENABLED = 27;
FSRS_LEGACY_EVALUATE = 28;
}
enum String {
SET_DUE_BROWSER = 0;

View file

@ -236,6 +236,7 @@ message DeckConfigsForUpdate {
bool new_cards_ignore_review_limit = 7;
bool fsrs = 8;
bool fsrs_health_check = 11;
bool fsrs_legacy_evaluate = 12;
bool apply_all_parent_limits = 9;
uint32 days_since_last_fsrs_optimize = 10;
}

View file

@ -651,7 +651,7 @@ exposed_backend_list = [
"compute_fsrs_params",
"compute_optimal_retention",
"set_wants_abort",
"evaluate_params",
"evaluate_params_legacy",
"get_optimal_retention_parameters",
"simulate_fsrs_review",
# DeckConfigService

View file

@ -39,6 +39,7 @@ impl From<BoolKeyProto> for BoolKey {
BoolKeyProto::RenderLatex => BoolKey::RenderLatex,
BoolKeyProto::LoadBalancerEnabled => BoolKey::LoadBalancerEnabled,
BoolKeyProto::FsrsShortTermWithStepsEnabled => BoolKey::FsrsShortTermWithStepsEnabled,
BoolKeyProto::FsrsLegacyEvaluate => BoolKey::FsrsLegacyEvaluate,
}
}
}

View file

@ -41,6 +41,7 @@ pub enum BoolKey {
WithDeckConfigs,
Fsrs,
FsrsHealthCheck,
FsrsLegacyEvaluate,
LoadBalancerEnabled,
FsrsShortTermWithStepsEnabled,
#[strum(to_string = "normalize_note_text")]

View file

@ -74,6 +74,7 @@ impl Collection {
apply_all_parent_limits: self.get_config_bool(BoolKey::ApplyAllParentLimits),
fsrs: self.get_config_bool(BoolKey::Fsrs),
fsrs_health_check: self.get_config_bool(BoolKey::FsrsHealthCheck),
fsrs_legacy_evaluate: self.get_config_bool(BoolKey::FsrsLegacyEvaluate),
days_since_last_fsrs_optimize,
})
}

View file

@ -10,7 +10,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { SimulateFsrsReviewRequest } from "@generated/anki/scheduler_pb";
import {
computeFsrsParams,
evaluateParams,
evaluateParamsLegacy,
getRetentionWorkload,
setWantsAbort,
} from "@generated/backend";
@ -244,10 +244,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
const search = $config.paramSearch
? $config.paramSearch
: defaultparamSearch;
const resp = await evaluateParams({
const resp = await evaluateParamsLegacy({
search,
ignoreRevlogsBeforeMs: getIgnoreRevlogsBeforeMs(),
numOfRelearningSteps: $config.relearnSteps.length,
params: fsrsParams($config),
});
if (computeParamsProgress) {
computeParamsProgress.current = computeParamsProgress.total;
@ -361,8 +361,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{tr.deckConfigOptimizeButton()}
{/if}
</button>
{#if false}
<!-- Can be re-enabled by some method in the future -->
{#if state.legacyEvaluate}
<button
class="btn {checkingParams ? 'btn-warning' : 'btn-primary'}"
disabled={!checkingParams && computing}

View file

@ -63,6 +63,7 @@ export class DeckOptionsState {
readonly fsrs: Writable<boolean>;
readonly fsrsReschedule: Writable<boolean> = writable(false);
readonly fsrsHealthCheck: Writable<boolean>;
readonly legacyEvaluate: boolean;
readonly daysSinceLastOptimization: Writable<number>;
readonly currentPresetName: Writable<string>;
/** Used to detect if there are any pending changes */
@ -105,6 +106,7 @@ export class DeckOptionsState {
this.applyAllParentLimits = writable(data.applyAllParentLimits);
this.fsrs = writable(data.fsrs);
this.fsrsHealthCheck = writable(data.fsrsHealthCheck);
this.legacyEvaluate = data.fsrsLegacyEvaluate;
this.daysSinceLastOptimization = writable(data.daysSinceLastFsrsOptimize);
// decrement the use count of the starting item, as we'll apply +1 to currently