Commit b184b69bce626ca343b1f4a17063e3b91806f575

Authored by Rohan Rangray
1 parent cab847f4e8
Exists in master

Extra checks to make sure a userflashcard's interval doesn't fall below 1

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

flashcards/models.py View file @ b184b69
... ... @@ -227,7 +227,7 @@
227 227 self.last_interval = 6
228 228 else:
229 229 self.last_response_factor = max(1.3, self.last_response_factor + (0.1 - (5 - q) * (0.08 + (5 - q) * 0.02)))
230   - self.last_interval += (now() - self.next_review).days
  230 + self.last_interval = max(1, self.last_interval + (now() - self.next_review).days)
231 231 self.last_interval = int(round(self.last_interval * self.last_response_factor))
232 232 self.next_review = user_flashcard_quiz.when + timedelta(days=self.last_interval)
233 233 self.save()