Commit 8a4e3756dd9b5ffa33d65432d4fba5562736adae

Authored by Andrew Buss
Exists in master

Merge branch 'master' of git.ucsd.edu:110swag/flashy-backend

Showing 1 changed file Side-by-side Diff

flashcards/models.py View file @ 8a4e375
... ... @@ -99,6 +99,8 @@
99 99 "noreply@flashy.cards", [self.email])
100 100  
101 101 def notify(self):
  102 + if self.registration_id is None:
  103 + raise ValueError("user's registration_id is null")
102 104 gcm_ctx = gcm.GCM(GCM_API_KEY)
103 105 try:
104 106 gcm_ctx.plaintext_request(
105 107  
... ... @@ -227,9 +229,9 @@
227 229 self.last_interval = 6
228 230 else:
229 231 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 = max(1, self.last_interval + (now() - self.next_review).days)
  232 + # self.last_interval = max(1, self.last_interval + (now() - self.next_review).days)
231 233 self.last_interval = int(round(self.last_interval * self.last_response_factor))
232   - self.next_review = user_flashcard_quiz.when + timedelta(days=self.last_interval)
  234 + self.next_review = now() + timedelta(days=self.last_interval)
233 235 self.save()
234 236  
235 237 class Meta: