Fix: Calculate prices

This commit is contained in:
Amritanshu Agrawal 2023-12-25 10:54:02 +05:30
parent 2af766a8b3
commit 2cdf7e8688

View File

@ -30,7 +30,7 @@ def calculate_prices(period_id: uuid.UUID, db: Session):
ingredients = set(db.execute(select(distinct(RecipeItem.product_id))).scalars().all()) ingredients = set(db.execute(select(distinct(RecipeItem.product_id))).scalars().all())
issued_products = get_issue_prices(item, ingredients - recipes, db) issued_products = get_issue_prices(item, ingredients - recipes, db)
left = ingredients - recipes - issued_products.keys() left = ingredients - recipes - issued_products.keys()
purchased_products = get_issue_prices(item, left, db) purchased_products = get_purchase_prices(item, left, db)
left -= purchased_products.keys() left -= purchased_products.keys()
rest = get_rest(left, db) rest = get_rest(left, db)
prices = issued_products | purchased_products | rest prices = issued_products | purchased_products | rest