Skip to content

Commit

Permalink
Fix/FSRS Visualizer for Filtered Decks (#526)
Browse files Browse the repository at this point in the history
Co-authored-by: ishiko <[email protected]>
  • Loading branch information
L-M-Sherlock and ishiko732 authored Jan 4, 2025
1 parent f5f31a4 commit e822029
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,20 @@ def rate_on_ankiweb(did=None):


def visualize_schedule(did=None):
url = "https://open-spaced-repetition.github.io/anki_fsrs_visualizer"
deck = mw.col.decks.current()
config = mw.col.decks.get_config(deck["conf"])
retention = config["desiredRetention"]
fsrs_params = (
config["fsrsParams5"]
if "fsrsParams5" in config and len(config["fsrsParams5"]) > 0
else config["fsrsWeights"]
)
fsrs_params_string = ",".join(f"{x:.4f}" for x in fsrs_params)

openLink(
f"https://open-spaced-repetition.github.io/anki_fsrs_visualizer/?w={fsrs_params_string}&m={retention}"
)
if "conf" in deck:
config = mw.col.decks.get_config(deck["conf"])
retention = config["desiredRetention"]
fsrs_params = (
config["fsrsParams5"]
if "fsrsParams5" in config and len(config["fsrsParams5"]) > 0
else config["fsrsWeights"]
)
fsrs_params_string = ",".join(f"{x:.4f}" for x in fsrs_params)
url += f"/?w={fsrs_params_string}&m={retention}"

openLink(url)


menu_visualize = build_action(visualize_schedule, "Visualize Your FSRS Schedule")
Expand Down

0 comments on commit e822029

Please sign in to comment.