Exemple #1
0
 def test_userspecifics_needing_review_are_flagged(self):
     self.review.needs_review = False
     self.review.last_studied = past_time(5)
     self.review.save()
     all_srs()
     review = UserSpecific.objects.get(pk=self.review.id)
     self.assertTrue(review.needs_review)
Exemple #2
0
 def test_userspecifics_needing_review_are_flagged(self):
     self.review.needs_review = False
     self.review.last_studied = past_time(5)
     self.review.save()
     all_srs()
     review = UserSpecific.objects.get(pk=self.review.id)
     self.assertTrue(review.needs_review)
Exemple #3
0
 def get(self, request, *args, **kwargs):
     user = request.user
     number_of_reviews = all_srs(user)
     new_review_count = get_users_current_reviews(user).count()
     logger.info("{} has requested an SRS update. {} reviews added. {} reviews total.".format(user.username,
                                                                                              number_of_reviews or 0,
                                                                                              new_review_count or 0))
     return HttpResponse(new_review_count)
Exemple #4
0
    def test_users_who_are_on_vacation_are_ignored_by_all_srs_algorithm(self):
        self.review.last_studied = past_time(10)
        self.review.streak = 1
        self.review.needs_review = False
        self.review.save()

        reviews_affected = all_srs()
        self.assertEqual(reviews_affected, 1)

        self.review.last_studied = past_time(10)
        self.review.streak = 1
        self.review.needs_review = False
        self.review.save()

        self.user.profile.on_vacation = True
        self.user.profile.save()

        reviews_affected = all_srs()
        self.assertEqual(reviews_affected, 0)
Exemple #5
0
    def test_users_who_are_on_vacation_are_ignored_by_all_srs_algorithm(self):
        self.review.last_studied = past_time(10)
        self.review.streak = 1
        self.review.needs_review = False
        self.review.save()

        reviews_affected = all_srs()
        self.assertEqual(reviews_affected, 1)

        self.review.last_studied = past_time(10)
        self.review.streak = 1
        self.review.needs_review = False
        self.review.save()

        self.user.profile.on_vacation = True
        self.user.profile.save()

        reviews_affected = all_srs()
        self.assertEqual(reviews_affected, 0)
Exemple #6
0
 def srs(self, request):
     all_srs(request.user)
     new_review_count = get_users_current_reviews(request.user).count()
     return Response({"review_count": new_review_count})
Exemple #7
0
 def srs(self, request):
     all_srs(request.user)
     new_review_count = get_users_current_reviews(request.user).count()
     return Response({'review_count': new_review_count})