From b184b69bce626ca343b1f4a17063e3b91806f575 Mon Sep 17 00:00:00 2001 From: Rohan Rangray Date: Wed, 3 Jun 2015 14:20:54 -0700 Subject: [PATCH] Extra checks to make sure a userflashcard's interval doesn't fall below 1 --- flashcards/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flashcards/models.py b/flashcards/models.py index e20b587..b9574b3 100644 --- a/flashcards/models.py +++ b/flashcards/models.py @@ -227,7 +227,7 @@ class UserFlashcard(Model): self.last_interval = 6 else: self.last_response_factor = max(1.3, self.last_response_factor + (0.1 - (5 - q) * (0.08 + (5 - q) * 0.02))) - self.last_interval += (now() - self.next_review).days + self.last_interval = max(1, self.last_interval + (now() - self.next_review).days) self.last_interval = int(round(self.last_interval * self.last_response_factor)) self.next_review = user_flashcard_quiz.when + timedelta(days=self.last_interval) self.save() -- 1.9.1