Custom Scheduling help request: larger interval after relearning only sometimes

Currently, my relearning steps are “10m 1d” on some decks, and “10m 1d 2d” on some others. My “new interval” is currently 0.

I would like to set my options up so that:

  • if I ever press “again” or “hard” at ANY POINT when a card is in relearning, the intervals start over when it exits relearning (as though “new interval” is 0)
  • if I ONLY press “good” or “easy” when a card is in relearning, the interval retains some progress when it exits relearning (for this post, let’s say 10% the interval it has before, which I think is as though “new interval” is set to 0.1. yes, I know this is not recommended, but I would like to try it for a while.)

I don’t know if I completely understand how custom scheduling works, so I want some feedback before I try using this for real. This is the approach I plan to take:

  • Set “new interval” to 0.1, leave my learning steps alone
  • In “custom scheduling”, do this :
if (states.current.normal && states.current.normal.relearning && states.hard.normal && states.hard.normal.relearning) {
  states.hard.normal.relearning.review.scheduledDays = 1;
}
//and similar for normal/again, filtered/hard, and filtered/again

Questions:

  • Does this look like it will do what I want it to do?
  • Do I seem to have any major misunderstandings of the settings or custom scheduling states, and will this do what I’m trying to make it do?
  • Do you have advice for testing custom scheduling code without waiting long periods of time for intervals to build up?
  • Does setting scheduledDays to 1 in a relearning step have the same effect as if “new interval” = 0? (If not, what does scheduledDays do? and how do I achieve the desired effect?)
  • What are the question marks in the example code?
// if the hard button is a learning step, make it
// a 123 minute delay
if (states.hard.normal?.learning) {
  states.hard.normal.learning.scheduledSecs = 123 * 60;
}
  • As far as I can tell, the only thing you can access from the “custom scheduling” javascript box is the “states” variable. Is that correct?
  • Are there any plans to make more than the current and next states available to custom scheduling in the future? I love v3 custom scheduling - #5 by dae

I’ll leave most of these questions for someone else, but to answer a few:

  • Yes, you seem to be on the right track. Use the card info and previous card info dialogs, and the console.log() statement with Console Output - Writing Anki Add-ons to check it’s doing what you expect.
  • Optional chaining (?.) - JavaScript | MDN
  • You don’t have access to deck options or other card data (that may come at one point), but the code is run in the webview after the question side has been loaded, so you could inspect the contents of the card.