Skip to content

Commit

Permalink
Patch for #462 (#469)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarrett Ye <[email protected]>
  • Loading branch information
user1823 and L-M-Sherlock authored Sep 27, 2024
1 parent 8c183e9 commit 370000d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"auto_disperse_when_review": false,
"auto_disperse_after_reschedule": false,
"mature_ivl": 21,
"reschedule_threshold": 0.25,
"reschedule_threshold": 0,
"debug_notify": false,
"fsrs_stats": true,
"display_memory_state": false,
"auto_easy_days": false,
"has_rated": false,
"has_sponsored": false,
"skip_manual_resched_cards": false
}
}
27 changes: 15 additions & 12 deletions schedule/reschedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def apply_fuzz(self, ivl):
)
return best_ivl

def next_interval(self, stability):
def fuzzed_next_interval(self, stability):
new_interval = next_interval(stability, self.desired_retention)
return self.apply_fuzz(new_interval)

Expand Down Expand Up @@ -366,21 +366,24 @@ def reschedule_card(cid, fsrs: FSRS, recompute=False):
if card.type == CARD_TYPE_REV:
fsrs.set_card(card)
fsrs.set_fuzz_factor(cid, card.reps)
new_ivl = fsrs.next_interval(s)
new_ivl = fsrs.fuzzed_next_interval(s)

dr = fsrs.desired_retention
odds = dr / (1 - dr)
if fsrs.reschedule_threshold > 0 and not fsrs.apply_easy_days:
dr = fsrs.desired_retention
odds = dr / (1 - dr)

reduced_odds = (1 - fsrs.reschedule_threshold) * odds
fsrs.desired_retention = reduced_odds / (reduced_odds + 1)
adjusted_ivl_upper = fsrs.next_interval(s)
odds_lower = (1 - fsrs.reschedule_threshold) * odds
fsrs.desired_retention = odds_lower / (odds_lower + 1)
adjusted_ivl_upper = next_interval(s)

increased_odds = (1 + fsrs.reschedule_threshold) * odds
fsrs.desired_retention = increased_odds / (increased_odds + 1)
adjusted_ivl_lower = fsrs.next_interval(s)
odds_upper = (1 + fsrs.reschedule_threshold) * odds
fsrs.desired_retention = odds_upper / (odds_upper + 1)
adjusted_ivl_lower = next_interval(s)

if card.ivl >= adjusted_ivl_lower and card.ivl <= adjusted_ivl_upper:
return None
fsrs.desired_retention = dr

if card.ivl >= adjusted_ivl_lower and card.ivl <= adjusted_ivl_upper:
return None

due_before = card.odue if card.odid else card.due
card = update_card_due_ivl(card, new_ivl)
Expand Down

0 comments on commit 370000d

Please sign in to comment.