Removed UTF-8 annotations, better count

This commit is contained in:
Titouan Vervack 2018-03-10 00:50:02 +01:00
parent a911f6ef88
commit b611fe5961
5 changed files with 1 additions and 15 deletions

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from models import Location, Product
from app import db
from itertools import product

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from models import Location, Product
from app import db

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from collections import defaultdict
@ -110,12 +108,6 @@ class Order(db.Model):
return group
def len(self):
size = 0
for _ in self.items:
size = size + 1
return size
def group_by_product(self):
group = dict()
for item in self.items:

View file

@ -78,7 +78,7 @@
</table>
</div>
<div class="col-md-push-2 col-md-4 darker" id="items-ordered">
<h3>Ordered products: {{ order.len() }}</h3>
<h3>Ordered products: {{ order.items.count() }}</h3>
{% for key, value in order.group_by_product().items() -%}
<div class="product">
{{ key }}: {{ value["count"] }}

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from flask import render_template