fix: removed crap, category on service and deal

This commit is contained in:
2024-09-27 04:50:01 +03:00
parent 5df64d4916
commit 91cf44f3ae
10 changed files with 258 additions and 64 deletions

View File

@@ -130,6 +130,14 @@ class DealService(BaseService):
user,
deadline=request.acceptance_date,
comment=request.comment)
# add category if specified
if request.category:
deal_category = DealPriceCategory(
deal_id=deal.id,
category_id=request.category.id
)
self.session.add(deal_category)
await self.session.commit()
return DealQuickCreateResponse(deal_id=deal.id)
@@ -1004,7 +1012,7 @@ class DealService(BaseService):
for product in deal.products:
total_one_product = sum((service.price for service in product.services))
total = total_one_product * product.quantity
totals.append({ "total_one_product": total_one_product, "total": total })
totals.append({"total_one_product": total_one_product, "total": total})
return totals