Only count positive stock for "Total" stats

This commit is contained in:
Christoffer Viken 2017-06-05 12:33:06 +00:00
parent fd67aed7dd
commit 078ccf6b8a

View File

@ -69,7 +69,7 @@ class BalanceMenu(Menu):
self.print_header()
text = ''
total_value = 0
product_list = self.session.query(Product).all()
product_list = self.session.query(Product).filter(Product.stock > 0).all()
for p in product_list:
total_value += p.stock * p.price