fix(bill delay):fix create record
This commit is contained in:
@@ -67,8 +67,11 @@ class BillDelayRepository(BaseRepository):
|
||||
delay = await super().create(coding)
|
||||
project = await use_collection(TaskEnv.CLN_PROJECT).find_one({"_id": coding.project_id})
|
||||
project_model = ProjectModel(**project)
|
||||
date_delay = project_model.date_delay + datetime.timedelta(days=coding.total_day)
|
||||
await use_collection(TaskEnv.CLN_PROJECT).update_one({"_id": coding.project_id}, {"$inc": {"all_delay_day":coding.total_day},"$set":{"date_delay":date_delay}})
|
||||
if 'date_delay' in project:
|
||||
date_delay = project_model.date_delay + datetime.timedelta(days=coding.total_day)
|
||||
await use_collection(TaskEnv.CLN_PROJECT).update_one({"_id": coding.project_id}, {"$inc": {"all_delay_day":coding.total_day},"$set":{"date_delay":date_delay}})
|
||||
else:
|
||||
await use_collection(TaskEnv.CLN_PROJECT).update_one({"_id": coding.project_id}, {"$inc": {"all_delay_day":coding.total_day}})
|
||||
return delay
|
||||
async def update(self, _id: UUID, update: BillDelayModel):
|
||||
old = await self.get(_id)
|
||||
|
||||
Reference in New Issue
Block a user