feat(financial_status):add update project_price
This commit is contained in:
@@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user