Fix/simulator crashes if no history (#3405)

* Fix/simulator crashes if no history

* ./ninja format

* remove (experimental) from ComputeOptimalRetention

* update to fsrs-rs v1.2.2
This commit is contained in:
Jarrett Ye 2024-09-11 00:15:33 +08:00 committed by GitHub
parent 5335d748cf
commit 34809f2520
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 6 deletions

4
Cargo.lock generated
View file

@ -1864,9 +1864,9 @@ dependencies = [
[[package]]
name = "fsrs"
version = "1.2.0"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a6f86707f3588ae410917427aa986e8b281fd0fad96480afd150f3e694c0d76"
checksum = "1bbd56ab9e6c5d40802c7f73701b9cc4bccf9fa29037799a94ac9f1a94f1a5f7"
dependencies = [
"burn",
"itertools 0.12.1",

View file

@ -35,7 +35,7 @@ git = "https://github.com/ankitects/linkcheck.git"
rev = "184b2ca50ed39ca43da13f0b830a463861adb9ca"
[workspace.dependencies.fsrs]
version = "1.2.0"
version = "1.2.2"
# git = "https://github.com/open-spaced-repetition/fsrs-rs.git"
# rev = "58ca25ed2bc4bb1dc376208bbcaed7f5a501b941"
# path = "../open-spaced-repetition/fsrs-rs"

View file

@ -1225,7 +1225,7 @@
},
{
"name": "fsrs",
"version": "1.2.0",
"version": "1.2.2",
"authors": "Open Spaced Repetition",
"repository": "https://github.com/open-spaced-repetition/fsrs-rs",
"license": "BSD-3-Clause",

View file

@ -20,6 +20,13 @@ impl From<FSRSError> for AnkiError {
backtrace: None,
},
},
FSRSError::InvalidDeckSize => AnkiError::InvalidInput {
source: InvalidInputError {
message: "no cards to simulate".to_string(),
source: None,
backtrace: None,
},
},
}
}
}

View file

@ -319,8 +319,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
() => {},
);
} finally {
simulateProgressString = "";
if (resp) {
simulateProgressString = "";
const dailyTimeCost = movingAverage(
resp.dailyTimeCost,
Math.round(simulateFsrsRequest.daysToSimulate / 50),
@ -420,7 +420,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<div class="m-2">
<details>
<summary>{tr.deckConfigComputeOptimalRetention()} (experimental)</summary>
<summary>{tr.deckConfigComputeOptimalRetention()}</summary>
<SpinBoxRow
bind:value={optimalRetentionRequest.daysToSimulate}