]> rtime.felk.cvut.cz Git - coffee/coffee-flask.git/commitdiff
Fix data acquisition for flavor graph.
authorJaroslav Klapalek <klapajar@fel.cvut.cz>
Wed, 14 Nov 2018 07:49:50 +0000 (08:49 +0100)
committerMichal Sojka <michal.sojka@cvut.cz>
Wed, 14 Nov 2018 07:58:17 +0000 (08:58 +0100)
Function 'coffee_flavors' wasn't doing what it was supposed to do.
Upper bound was shifted by a day (so for a week graph it was count-
ing 8 days) and also it didn't take into account 'start' variable.

coffee_db.py

index 8653f98fbb274377c1b7b17b5c5f33fba7dd922b..7e28f923d851e25c37e2e8eb22cbf49766441dba 100644 (file)
@@ -77,7 +77,7 @@ def coffee_flavors(uid=None, days=0, start=0):
     variables = list()
 
     if days is not None and days != 0:
-        query += " where date(time) between date('now', 'localtime', '-"+ str(days) +" days') and date('now', 'localtime', '-"+ str(start) +" days')"
+        query += " where date(time) between date('now', 'localtime', '-"+ str(days+start-1) +" days') and date('now', 'localtime', '-"+ str(start) +" days')"
 
         if uid is not None:
             query += " and id = ?"