Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. from anki.hooks import wrap
  2. from anki.sched import Scheduler
  3. from aqt import mw
  4. from aqt.utils import tooltip
  5.  
  6. threshold_interval = 7
  7. threshold_field = u"Learned"
  8. threshold_suspend_tag = u"suspendable"
  9.  
  10. def threshold(self, card, ease):
  11. f = card.note()
  12.  
  13. if (card.ivl >= threshold_interval):
  14. if threshold_field in mw.col.models.fieldNames(f.model()) and not f[threshold_field]:
  15. f[threshold_field] = 'Yes'
  16. if f.hasTag(threshold_suspend_tag) and card.queue != -1:
  17. mw.col.sched.suspendCards([card.id])
  18. f.delTag(threshold_suspend_tag)
  19.  
  20. f.flush()
  21. return True
  22.  
  23. Scheduler.answerCard = wrap(Scheduler.answerCard, threshold)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement