fig = plt.figure(figsize=(3, 3))
ax = fig.add_subplot(111)
ax.set_aspect(1)
- ax.pie(counts, autopct=lambda p: '{:.0f}'.format(p * sum(counts)/100))
+ ax.pie(counts, autopct=lambda p: '{:.0f}'.format(p * sum(counts)/100) if p != 0 else '')
ax.legend(flavors, bbox_to_anchor=(1.0, 1.0))
ax.set_title("Your taste")
fig.savefig(b, format="svg", bbox_inches="tight")
def coffee_add():
if request.method == "POST":
json = request.json
- if json and "uid" in session:
- db.add_coffee(session["uid"], json["flavor"], json["time"])
+ print("User '%(uid)s' had '%(flavor)s' at %(time)s" % json)
+ db.add_coffee(json["uid"], json["flavor"], json["time"])
return redirect(url_for('user'))
def log():
if request.method == "POST":
data = request.data.decode("utf-8")
- print(data)
+ print("Log:", data)
return data
return "nope"