Skip to content

Commit

Permalink
Fix/handle exception at constrain interval (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock authored Nov 14, 2022
1 parent f01cfe1 commit 956d1b7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fsrs4anki_simulator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"id": "jmXx-hS9ZMVj"
},
"source": [
"# FSRS4Anki v3.8.0 Simulator"
"# FSRS4Anki v3.8.3 Simulator"
]
},
{
Expand All @@ -15,7 +15,7 @@
"id": "lurCmW0Jqz3s"
},
"source": [
"[![open in colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-spaced-repetition/fsrs4anki/blob/v3.8.0/fsrs4anki_simulator.ipynb)\n",
"[![open in colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-spaced-repetition/fsrs4anki/blob/v3.8.3/fsrs4anki_simulator.ipynb)\n",
"\n",
"↑ Click the above button to open the simulator on Google Colab.\n",
"\n",
Expand Down Expand Up @@ -370,7 +370,10 @@
"\n",
"def fsrs4anki_scheduler(last_stability, stability, rating):\n",
" def constrain_interval(stability):\n",
" return min(max(1, round(stability * np.log(requestRetention) / np.log(0.9))), maximumInterval)\n",
" if stability > 0:\n",
" return min(max(1, round(stability * np.log(requestRetention) / np.log(0.9))), maximumInterval)\n",
" else:\n",
" return 1\n",
" if last_stability is None:\n",
" return constrain_interval(stability)\n",
" again_interval = constrain_interval(stability)\n",
Expand Down Expand Up @@ -643,7 +646,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:16) \n[Clang 12.0.1 ]"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit 956d1b7

Please sign in to comment.