Removed UTF-8 annotations, better count
This commit is contained in:
parent
a911f6ef88
commit
b611fe5961
5 changed files with 1 additions and 15 deletions
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from models import Location, Product
|
||||
from app import db
|
||||
from itertools import product
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from models import Location, Product
|
||||
from app import db
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"] }}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datetime import datetime
|
||||
from flask import render_template
|
||||
|
||||
|
|
Loading…
Reference in a new issue