if stop is not None:
clauses.append("date(time, 'localtime') <= date('now', 'localtime', '-%d days')" % int(stop))
- return dict(c.execute("select case when flavor like 'Club%' then 'Club-Mate' else 'Coffee' end as drink, count(*) "
- "from coffees co left join identifiers ids on co.id = ids.id where "
- + " and ".join(clauses) + " group by drink", args))
+ return list(c.execute("select fl.type, count(*) from coffees co "
+ "left join flavors fl on co.flavor = fl.name "
+ "left join identifiers ids on co.id = ids.id where "
+ + " and ".join(clauses) + " group by fl.type "
+ "order by fl.ord asc", args))