Skip to content

Card Priority Scheduler V3

Ricardo edited this page May 11, 2023 · 2 revisions

Anki Scheduler version 3 was completely re-written. That is, it's not based on older Schedulers.
With that, add-ons can't modify the Scheduling time directly anymore.

Anki provides a way for final users to do that, regardless of Add-ons.
This is described at: https://faqs.ankiweb.net/the-2021-scheduler.html

With this restriction, the integration with Card Priority add-on is different from before.
For this Scheduler, the add-on can't set the next intervals anymore.
Instead of that, the add-on provides a variable that can be used in the script mentioned above: card_multiplier.

How does it work

In the add-on configuration, you can define by how much percent should Anki's given interval be multiplied - which is distinct depending on the priority.
That's documented at: https://github.com/ssricardo/anki-plugins/tree/master/schedule-priority#how-to-customize-it .

This is the source of the value that will be available as a Javascript variable, named card_multiplier.
The card_multiplier will already contain the configured percentage divided by 100.
The value provided will already consider the card priority.

Example

Let's say your configuration is:

{
  "Lowest": 190,
  "Low": 130,
  "High": 72,
  "Highest": 60
}
  1. Comes a card with priority High:
  • card_multiplier will be = 0.72
  1. Next card has priority Lowest:
  • card_multiplier will be = 1.90

Then you can use it, and do the math as you wish.

Sample scripts

// change the ease factor according to the card_multipler, when Good used on a review
if (states.good.normal?.review) {
  states.good.normal.review.easeFactor = states.good.normal.review.easeFactor * card_multiplier;
}

Or changing the time (similar to what the add-on does on v2)

// change the ease factor according to the card_multipler, when Good used on a review
if (states.easy.normal?.review) {
  states.easy.normal.review.scheduledDays = Math.round(states.easy.normal.review.scheduledDays * card_multiplier); // use round to have days as integer
}

And so on...

A possible good practice, is initializing the card_multiplier value, in case it's not present. For instance, on mobile app.

if (!card_multiplier) {
  var card_multiplier = 1;
}