From 70774e892b07f667b0bdff1d3588f415f5c143f7 Mon Sep 17 00:00:00 2001 From: Bernhard Stampfer Date: Fri, 26 Feb 2016 17:22:17 +0100 Subject: [PATCH] - added product photos, some stuff on personal page --- app/database.py | 10 +++++---- app/static/style.css | 12 +++++++++++ app/templates/consume.html | 26 ++++++++++++++++-------- app/templates/index.html | 7 ------- app/templates/manage_beverages_add.html | 3 ++- app/templates/manage_beverages_edit.html | 3 ++- app/views.py | 23 ++++++++++++++++++++- 7 files changed, 61 insertions(+), 23 deletions(-) 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 %} -

TODO:

-

Konsumieren

{% if message %} -

{{ message }}

+
{{ message }}
{% endif %} -

+

{% if user.isblack %} Sorry, du bist geschwärzt! {% else %} - Möchtest du etwas konsumieren? +

Möchtest du etwas konsumieren?

{% for product in products %} {% if product.isshown %} -

{{ product.id }}, {{product.name}} , {{"%0.2f" % product.price}} €

+ +
+ +
+

{{product.name}}

+ {% set fils = "product_%s.png" % product.name %} +
+
+
+ {{"%0.2f" % product.price}} € +
+
+
{% endif %} {% endfor %} {% endif %} -

+
{% endblock %} diff --git a/app/templates/index.html b/app/templates/index.html index 59f1d3a..1166fea 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -5,13 +5,6 @@ - -

Bierkonsum

- - {% if user %} - {% set fils = "total%03d.png" % user.id %} - - {% endif %}

Bierliste