Skip to content

Commit

Permalink
Fix/simulator crashes if no history (#3405)
Browse files Browse the repository at this point in the history
* Fix/simulator crashes if no history

* ./ninja format

* remove (experimental) from ComputeOptimalRetention

* update to fsrs-rs v1.2.2
  • Loading branch information
L-M-Sherlock committed Sep 10, 2024
1 parent 5335d74 commit 34809f2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cargo/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions rslib/src/scheduler/fsrs/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
}
}
}
4 changes: 2 additions & 2 deletions ts/routes/deck-options/FsrsOptions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 34809f2

Please sign in to comment.