Created
October 17, 2014 13:03
-
-
Save kotarou3/e2fd20ed9e86730446ed to your computer and use it in GitHub Desktop.
Randomises the due dates of the cards in a deck, but only bringing them closer to being due. Run in Anki's REPL console (ctrl+:)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Randomises the due dates of the cards in a deck, but only bringing them closer to being due | |
# Run in Anki's REPL console (ctrl+:) | |
from random import random | |
from math import floor | |
deckName = u"わかった!" | |
for cid in self.col.decks.cids(self.col.decks.byName(deckName)["id"], True): | |
card = self.col.getCard(cid) | |
due = abs(card.due - self.col.sched.today) | |
isDuePositive = card.due - self.col.sched.today >= 0 | |
if due >= 2: | |
adjustment = floor(random() * (due / 2 + 1)) | |
card.due = (due - adjustment) * (1 if isDuePositive else -1) + self.col.sched.today | |
card.flushSched() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment