From d937b9599a6fe7d2ed54d1d2e2f97ee7d5fed227 Mon Sep 17 00:00:00 2001 From: shahzeydyfah Date: Tue, 21 Jan 2025 00:00:12 +0330 Subject: [PATCH] feat(financial_status):add update project_price --- app/repositories/financial_status.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/repositories/financial_status.py b/app/repositories/financial_status.py index f56fc63..76aa80f 100644 --- a/app/repositories/financial_status.py +++ b/app/repositories/financial_status.py @@ -26,12 +26,13 @@ class FinancialStatusRepository(BaseRepository): result = await super().update(_id, _update) price = await use_collection(TaskEnv.CLN_PROJECT_PRICE_REPORT).find_one({'project_id': _update.project_id}) if price: + change = 0 _old = StatusFinancialModel(**_old_dic) if 'amount' not in _old_dic and _update.amount: change = _update.amount if _old.amount != _update.amount: change = _update.amount - _old.amount - if change > 0 : + if change != 0 : await use_collection(TaskEnv.CLN_PROJECT_PRICE_REPORT).update_one( {'project_id': _update.project_id}, {"$inc": {'amount_status': change}}