diff --git a/app/database.py b/app/database.py index 32c6155..a9c8365 100644 --- a/app/database.py +++ b/app/database.py @@ -150,9 +150,10 @@ def add_product(p): def get_consumed(user=None, startdate=None, enddate=None): - if user is None and startdate is None and enddate is None: + if user is None: rows = query_db('SELECT * FROM CONSUMED') - + else: + rows = query_db('SELECT * FROM CONSUMED WHERE CONSUMER=?', [get_user_by_name(user).id]) consumed = [] for row in rows: #ID|PRODNR|CONSUMER|PRICE|TIME @@ -163,8 +164,9 @@ def get_consumed(user=None, startdate=None, enddate=None): #2016-01-27 12:59:04 c.price = float(row[3]) c.time = datetime.datetime.strptime(row[4], "%Y-%m-%d %H:%M:%S") - consumed.append(c) - + if startdate is None or c.time > startdate: + if enddate is None or c.time < enddate: + consumed.append(c) return consumed def add_consume(username, productid): diff --git a/app/static/style.css b/app/static/style.css index 56f0c41..520d16a 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -49,6 +49,18 @@ div.item { float:left; text-decoration:none; } +/* PRODUCT FRAME */ +div.product { float:left; + min-width:144px; + min-height:144px; + background-color:#CC3333; + color:white; + padding:5px; + margin:5px; + border-radius:1px; + border:1px solid black; +} + /* MENU ITEM HOVER: greenish */ div.item:hover { background-color:#00AA88; } diff --git a/app/templates/consume.html b/app/templates/consume.html index 5c87026..ae2325a 100644 --- a/app/templates/consume.html +++ b/app/templates/consume.html @@ -1,24 +1,32 @@ {% extends "base.html"%} {% set title = "Konsumieren" %} {% block content %} -
{{ message }}
++
{{ product.id }}, {{product.name}} , {{"%0.2f" % product.price}} €
- {% if user %}
- {% set fils = "total%03d.png" % user.id %}
-