From 4ee307cc959a6d52174178b3a7bab552503e9ffd Mon Sep 17 00:00:00 2001 From: Gael Le Mignot Date: Mon, 29 Jul 2019 10:41:35 +0200 Subject: [PATCH] Workaround for weird bug due to comparing datetime and date objects --- teleforma/exam/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/teleforma/exam/models.py b/teleforma/exam/models.py index 27a3dd32..c649043a 100755 --- a/teleforma/exam/models.py +++ b/teleforma/exam/models.py @@ -167,7 +167,10 @@ class Quota(models.Model): def script_count(self, statuses): q = self.corrector.corrector_scripts.filter(status__in = statuses) q = q.filter(course=self.course) - q = q.filter(date_submitted__gte=self.date_start).filter(date_submitted__lte=self.date_end) + # Careful, MySQL considers '2019-07-28 11:42:00" to not be >= "2019-07-28" + start = self.date_start + end = self.date_end + datetime.timedelta(days = 1) + q = q.filter(date_submitted__gte=start).filter(date_submitted__lte=end) return q.count() -- 2.39.5