diff --git a/app/templates/order.html b/app/templates/order.html index 4828327..e005da4 100644 --- a/app/templates/order.html +++ b/app/templates/order.html @@ -9,15 +9,15 @@ {% if order.can_close(current_user.id) -%} Close
{%- endif %} - Courrier: {{ order.courrier.username }} + courrier: {{ order.courrier.username }} {% if order.courrier == None and not current_user.is_anonymous() %} Volunteer {% endif %}
- Location: {{ order.location.name }}
- Starttime: {{ order.starttime }}
- Stoptime: {{ order.stoptime }}
- Total price: {{ total_price|euro }} + location: {{ order.location.name }}
+ opened on {{ order.starttime }}
+ status: {% if order.stoptime %}{{ order.stoptime|countdown }}{% else %}open{% endif %}
+ total price: {{ total_price|euro }} {% if form -%}
diff --git a/app/utils.py b/app/utils.py index afa84ff..2148b1a 100644 --- a/app/utils.py +++ b/app/utils.py @@ -12,13 +12,16 @@ def euro(value): return result @app.template_filter('countdown') -def countdown(value): +def countdown(value, only_positive=True, show_text=True): delta = value - datetime.now() - if delta.total_seconds() < 0: + if delta.total_seconds() < 0 and only_positive: return "closed" hours, remainder = divmod(delta.seconds, 3600) minutes, seconds = divmod(remainder, 60) - return 'closes in %02d:%02d:%02d' % (hours, minutes, seconds) + time = '%02d:%02d:%02d' % (hours, minutes, seconds) + if show_text: + return 'closes in ' + time + return time @app.errorhandler(404) def handle404(e):