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
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ class BalanceMenu(Menu):
self.print_header() self.print_header()
text = '' text = ''
total_value = 0 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: for p in product_list:
total_value += p.stock * p.price total_value += p.stock * p.price