mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 22:13:58 -05:00
make global
This commit is contained in:
parent
d8fc152c57
commit
0db97dd1f3
8 changed files with 17 additions and 6 deletions
|
|
@ -193,7 +193,6 @@ message DeckConfig {
|
||||||
reserved 39;
|
reserved 39;
|
||||||
float historical_retention = 40;
|
float historical_retention = 40;
|
||||||
string param_search = 45;
|
string param_search = 45;
|
||||||
bool health_check = 47;
|
|
||||||
|
|
||||||
bytes other = 255;
|
bytes other = 255;
|
||||||
}
|
}
|
||||||
|
|
@ -236,6 +235,7 @@ message DeckConfigsForUpdate {
|
||||||
// only applies to v3 scheduler
|
// only applies to v3 scheduler
|
||||||
bool new_cards_ignore_review_limit = 7;
|
bool new_cards_ignore_review_limit = 7;
|
||||||
bool fsrs = 8;
|
bool fsrs = 8;
|
||||||
|
bool fsrs_health_check = 11;
|
||||||
bool apply_all_parent_limits = 9;
|
bool apply_all_parent_limits = 9;
|
||||||
uint32 days_since_last_fsrs_optimize = 10;
|
uint32 days_since_last_fsrs_optimize = 10;
|
||||||
}
|
}
|
||||||
|
|
@ -259,4 +259,5 @@ message UpdateDeckConfigsRequest {
|
||||||
bool fsrs = 8;
|
bool fsrs = 8;
|
||||||
bool apply_all_parent_limits = 9;
|
bool apply_all_parent_limits = 9;
|
||||||
bool fsrs_reschedule = 10;
|
bool fsrs_reschedule = 10;
|
||||||
|
bool fsrs_health_check = 11;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ pub enum BoolKey {
|
||||||
WithScheduling,
|
WithScheduling,
|
||||||
WithDeckConfigs,
|
WithDeckConfigs,
|
||||||
Fsrs,
|
Fsrs,
|
||||||
|
FsrsHealthCheck,
|
||||||
LoadBalancerEnabled,
|
LoadBalancerEnabled,
|
||||||
FsrsShortTermWithStepsEnabled,
|
FsrsShortTermWithStepsEnabled,
|
||||||
#[strum(to_string = "normalize_note_text")]
|
#[strum(to_string = "normalize_note_text")]
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@ const DEFAULT_DECK_CONFIG_INNER: DeckConfigInner = DeckConfigInner {
|
||||||
fsrs_params_5: vec![],
|
fsrs_params_5: vec![],
|
||||||
fsrs_params_6: vec![],
|
fsrs_params_6: vec![],
|
||||||
desired_retention: 0.9,
|
desired_retention: 0.9,
|
||||||
health_check: false,
|
|
||||||
other: Vec::new(),
|
other: Vec::new(),
|
||||||
historical_retention: 0.9,
|
historical_retention: 0.9,
|
||||||
param_search: String::new(),
|
param_search: String::new(),
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,6 @@ impl From<DeckConfSchema11> for DeckConfig {
|
||||||
desired_retention: c.desired_retention,
|
desired_retention: c.desired_retention,
|
||||||
historical_retention: c.sm2_retention,
|
historical_retention: c.sm2_retention,
|
||||||
param_search: c.param_search,
|
param_search: c.param_search,
|
||||||
health_check: false,
|
|
||||||
other: other_bytes,
|
other: other_bytes,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ impl From<anki_proto::deck_config::UpdateDeckConfigsRequest> for UpdateDeckConfi
|
||||||
apply_all_parent_limits: c.apply_all_parent_limits,
|
apply_all_parent_limits: c.apply_all_parent_limits,
|
||||||
fsrs: c.fsrs,
|
fsrs: c.fsrs,
|
||||||
fsrs_reschedule: c.fsrs_reschedule,
|
fsrs_reschedule: c.fsrs_reschedule,
|
||||||
|
fsrs_health_check: c.fsrs_health_check,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ pub struct UpdateDeckConfigsRequest {
|
||||||
pub apply_all_parent_limits: bool,
|
pub apply_all_parent_limits: bool,
|
||||||
pub fsrs: bool,
|
pub fsrs: bool,
|
||||||
pub fsrs_reschedule: bool,
|
pub fsrs_reschedule: bool,
|
||||||
|
pub fsrs_health_check: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Collection {
|
impl Collection {
|
||||||
|
|
@ -71,6 +72,7 @@ impl Collection {
|
||||||
new_cards_ignore_review_limit: self.get_config_bool(BoolKey::NewCardsIgnoreReviewLimit),
|
new_cards_ignore_review_limit: self.get_config_bool(BoolKey::NewCardsIgnoreReviewLimit),
|
||||||
apply_all_parent_limits: self.get_config_bool(BoolKey::ApplyAllParentLimits),
|
apply_all_parent_limits: self.get_config_bool(BoolKey::ApplyAllParentLimits),
|
||||||
fsrs: self.get_config_bool(BoolKey::Fsrs),
|
fsrs: self.get_config_bool(BoolKey::Fsrs),
|
||||||
|
fsrs_health_check: self.get_config_bool(BoolKey::FsrsHealthCheck),
|
||||||
days_since_last_fsrs_optimize,
|
days_since_last_fsrs_optimize,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -300,6 +302,7 @@ impl Collection {
|
||||||
req.new_cards_ignore_review_limit,
|
req.new_cards_ignore_review_limit,
|
||||||
)?;
|
)?;
|
||||||
self.set_config_bool_inner(BoolKey::ApplyAllParentLimits, req.apply_all_parent_limits)?;
|
self.set_config_bool_inner(BoolKey::ApplyAllParentLimits, req.apply_all_parent_limits)?;
|
||||||
|
self.set_config_bool_inner(BoolKey::FsrsHealthCheck, req.fsrs_health_check)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -453,6 +456,7 @@ mod test {
|
||||||
col.set_config_string_inner(StringKey::CardStateCustomizer, "")?;
|
col.set_config_string_inner(StringKey::CardStateCustomizer, "")?;
|
||||||
col.set_config_bool_inner(BoolKey::NewCardsIgnoreReviewLimit, false)?;
|
col.set_config_bool_inner(BoolKey::NewCardsIgnoreReviewLimit, false)?;
|
||||||
col.set_config_bool_inner(BoolKey::ApplyAllParentLimits, false)?;
|
col.set_config_bool_inner(BoolKey::ApplyAllParentLimits, false)?;
|
||||||
|
col.set_config_bool_inner(BoolKey::FsrsHealthCheck, true)?;
|
||||||
|
|
||||||
// pretend we're in sync
|
// pretend we're in sync
|
||||||
let stamps = col.storage.get_collection_timestamps()?;
|
let stamps = col.storage.get_collection_timestamps()?;
|
||||||
|
|
@ -489,6 +493,7 @@ mod test {
|
||||||
apply_all_parent_limits: false,
|
apply_all_parent_limits: false,
|
||||||
fsrs: false,
|
fsrs: false,
|
||||||
fsrs_reschedule: false,
|
fsrs_reschedule: false,
|
||||||
|
fsrs_health_check: true,
|
||||||
};
|
};
|
||||||
assert!(!col.update_deck_configs(input.clone())?.changes.had_change());
|
assert!(!col.update_deck_configs(input.clone())?.changes.had_change());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
let computingParams = false;
|
let computingParams = false;
|
||||||
let checkingParams = false;
|
let checkingParams = false;
|
||||||
|
|
||||||
|
const healthCheck = state.fsrsHealthCheck;
|
||||||
|
|
||||||
$: computing = computingParams || checkingParams;
|
$: computing = computingParams || checkingParams;
|
||||||
$: defaultparamSearch = `preset:"${state.getCurrentNameForSearch()}" -is:suspended`;
|
$: defaultparamSearch = `preset:"${state.getCurrentNameForSearch()}" -is:suspended`;
|
||||||
$: roundedRetention = Number($config.desiredRetention.toFixed(2));
|
$: roundedRetention = Number($config.desiredRetention.toFixed(2));
|
||||||
|
|
@ -179,7 +181,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
ignoreRevlogsBeforeMs: getIgnoreRevlogsBeforeMs(),
|
ignoreRevlogsBeforeMs: getIgnoreRevlogsBeforeMs(),
|
||||||
currentParams: params,
|
currentParams: params,
|
||||||
numOfRelearningSteps: numOfRelearningStepsInDay,
|
numOfRelearningSteps: numOfRelearningStepsInDay,
|
||||||
healthCheck: $config.healthCheck,
|
healthCheck: $healthCheck,
|
||||||
});
|
});
|
||||||
|
|
||||||
const already_optimal =
|
const already_optimal =
|
||||||
|
|
@ -333,9 +335,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<Warning warning={tr.deckConfigRescheduleCardsWarning()} />
|
<Warning warning={tr.deckConfigRescheduleCardsWarning()} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<SwitchRow bind:value={$config.healthCheck} defaultValue={false}>
|
<SwitchRow bind:value={$healthCheck} defaultValue={false}>
|
||||||
<SettingTitle on:click={() => openHelpModal("deckConfigHealthCheck")}>
|
<SettingTitle on:click={() => openHelpModal("deckConfigHealthCheck")}>
|
||||||
{tr.deckConfigHealthCheck()}
|
<GlobalLabel title={tr.deckConfigHealthCheck()} />
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
</SwitchRow>
|
</SwitchRow>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ export class DeckOptionsState {
|
||||||
readonly applyAllParentLimits: Writable<boolean>;
|
readonly applyAllParentLimits: Writable<boolean>;
|
||||||
readonly fsrs: Writable<boolean>;
|
readonly fsrs: Writable<boolean>;
|
||||||
readonly fsrsReschedule: Writable<boolean> = writable(false);
|
readonly fsrsReschedule: Writable<boolean> = writable(false);
|
||||||
|
readonly fsrsHealthCheck: Writable<boolean>;
|
||||||
readonly daysSinceLastOptimization: Writable<number>;
|
readonly daysSinceLastOptimization: Writable<number>;
|
||||||
readonly currentPresetName: Writable<string>;
|
readonly currentPresetName: Writable<string>;
|
||||||
/** Used to detect if there are any pending changes */
|
/** Used to detect if there are any pending changes */
|
||||||
|
|
@ -103,6 +104,7 @@ export class DeckOptionsState {
|
||||||
this.newCardsIgnoreReviewLimit = writable(data.newCardsIgnoreReviewLimit);
|
this.newCardsIgnoreReviewLimit = writable(data.newCardsIgnoreReviewLimit);
|
||||||
this.applyAllParentLimits = writable(data.applyAllParentLimits);
|
this.applyAllParentLimits = writable(data.applyAllParentLimits);
|
||||||
this.fsrs = writable(data.fsrs);
|
this.fsrs = writable(data.fsrs);
|
||||||
|
this.fsrsHealthCheck = writable(data.fsrsHealthCheck);
|
||||||
this.daysSinceLastOptimization = writable(data.daysSinceLastFsrsOptimize);
|
this.daysSinceLastOptimization = writable(data.daysSinceLastFsrsOptimize);
|
||||||
|
|
||||||
// decrement the use count of the starting item, as we'll apply +1 to currently
|
// decrement the use count of the starting item, as we'll apply +1 to currently
|
||||||
|
|
@ -267,6 +269,7 @@ export class DeckOptionsState {
|
||||||
applyAllParentLimits: get(this.applyAllParentLimits),
|
applyAllParentLimits: get(this.applyAllParentLimits),
|
||||||
fsrs: get(this.fsrs),
|
fsrs: get(this.fsrs),
|
||||||
fsrsReschedule: get(this.fsrsReschedule),
|
fsrsReschedule: get(this.fsrsReschedule),
|
||||||
|
fsrsHealthCheck: get(this.fsrsHealthCheck),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue