[Coffee] [PATCH coffee-flask 1/2] Add graphs with total coffee consumption on login screen

Jiri Hubacek hubacji1 at fel.cvut.cz
Mon Sep 17 14:20:02 CEST 2018


I haven't test it, just pythonic feeling of syntax. Think that the patch
does not look bad, I found just minor issues.

> +        flavors, counts = zip(*db.coffee_flavors_history(uid))

I like tuple here but it's not used anywhere in the code, so lets keep
it consistent.

> +    ax.pie(counts, autopct=lambda p: '{:.0f}'.format(p * sum(counts)/100) if p != 0 else '')
Yes, I don't like lines *not wrapped* to 80 characters. Suggest at least
new line after `... p:` - it helps with the readability also.

> +        res = list(c.execute("""
> +            select f.name, count(c.flavor) from
> +            (select num,date('now', 'localtime', -num || ' days') as d from days) ds

Again this wrapping (sorry). Also, for the first view, the query doesn't
look nice. Guess that db queries can't be written nicely...

jiri



More information about the Coffee mailing list