ensure failed mature come at the start of the future day

- this fixes a state where cards failed on that future day could end up
  with an earlier due date that the rest of the failed mature cards, leading
  to the newly failed cards being repeated prematurely
- this leads to non-deterministic scheduling of the mature bonus fails, so
  they are effectively randomized which is probably what most users want
This commit is contained in:
Damien Elmes 2011-01-21 09:36:04 +09:00
parent 4859778d2c
commit 6860bba0de

View file

@ -936,13 +936,13 @@ and type between 1 and 2""",
def nextDue(self, card, ease, oldState): def nextDue(self, card, ease, oldState):
"Return time when CARD will expire given EASE." "Return time when CARD will expire given EASE."
if ease == 1: if ease == 1:
if oldState == "mature": # 600 is a magic value which means no bonus, and is used to ease
# FIXME: magic value until we have old clients updated # upgrades
if self.delay1 == 600: if oldState == "mature" and self.delay1 and self.delay1 != 600:
d = 0 # user wants a bonus of 1+ days. put the failed cards at the
else: # start of the future day, so that failures that day will come
d = self.delay1 # after the waiting cards
due = d*86400 return self.failedCutoff + (self.delay1 - 1)*86400
else: else:
due = 0 due = 0
else: else: