]> rtime.felk.cvut.cz Git - coffee/coffee-flask.git/blobdiff - app.py
Fix coffee graph for start of the month
[coffee/coffee-flask.git] / app.py
diff --git a/app.py b/app.py
index 54816242b4640af21592d5c153f659a4ccadd3f1..807f614540346279580a34e9add88712d4eddfa2 100644 (file)
--- a/app.py
+++ b/app.py
@@ -93,21 +93,21 @@ def coffee_graph_history():
     else:
         hist = db.coffee_history()
     if hist == []:
-        days = tuple()
+        unix_days = tuple()
         counts = tuple()
         flavors = tuple()
     else:
-        days, counts, flavors = zip(*hist)
+        unix_days, counts, flavors = zip(*hist)
     fig = plt.figure(figsize=(4, 3))
     ax = fig.add_subplot(111)
 
     list_flavor = sorted(db.flavors())
     l = [{} for i in range(len(list_flavor))]
     for ll in l:
-        for d in days:
+        for d in unix_days:
             ll[d] = 0
 
-    for(d, c, f) in zip(days, counts, flavors):
+    for(d, c, f) in zip(unix_days, counts, flavors):
         if f is None:
             continue
         what_f = 0
@@ -125,13 +125,13 @@ def coffee_graph_history():
         ax.bar(range(len(x)), y, bottom=z)
         z = [sum(i) for i in zip(y, z)]
 
-    days = set(days)
+    unix_days = set(unix_days)
     xdays = [i.strftime("%a") for i in [
         date.today() - timedelta(j - 1) for j in
-        range(len(days), 0, -1)]]
+        range(len(unix_days), 0, -1)]]
     xdays[-1] = "TDY"
     xdays[-2] = "YDA"
-    ax.set_xticks(range(len(days)))
+    ax.set_xticks(range(len(unix_days)))
     ax.set_xticklabels(xdays)
     ax.set_title("Your week")
     ax.yaxis.set_major_locator(MaxNLocator(integer=True))