feat(BillDelayModel):add total day
This commit is contained in:
@@ -46,3 +46,4 @@ class BillDelayModel(BaseModel):
|
||||
date_submission_bill: Optional[datetime] = Field(description='تاریخ ابلاغ لایحه')
|
||||
description: Optional[str] = Field(description='توضیحات')
|
||||
end_at: Optional[datetime] = Field(description='تاریخ خاتمه پیمان')
|
||||
total_day: Optional[int] = Field(default=0,description='جمع روزها')
|
||||
|
||||
@@ -10,6 +10,7 @@ class BillDelayRepository(BaseRepository):
|
||||
super().__init__(collection=TaskEnv.CLN_BILL_DELAY, model=BillDelayModel)
|
||||
|
||||
def create_sum(self, coding: BillDelayModel) -> BillDelayModel:
|
||||
all_total = 0
|
||||
if coding.financial:
|
||||
total = 0
|
||||
if coding.financial.status:
|
||||
@@ -21,6 +22,7 @@ class BillDelayRepository(BaseRepository):
|
||||
if coding.financial.good_job:
|
||||
total += coding.financial.good_job
|
||||
coding.financial.total = total
|
||||
all_total += total
|
||||
if coding.force_major:
|
||||
total = 0
|
||||
if coding.force_major.force_event:
|
||||
@@ -32,6 +34,7 @@ class BillDelayRepository(BaseRepository):
|
||||
if coding.force_major.define_indicators:
|
||||
total += coding.force_major.define_indicators
|
||||
coding.force_major.total = total
|
||||
all_total += total
|
||||
|
||||
if coding.technical:
|
||||
total = 0
|
||||
@@ -44,6 +47,13 @@ class BillDelayRepository(BaseRepository):
|
||||
if coding.technical.suspense:
|
||||
total += coding.technical.suspense
|
||||
coding.technical.total = total
|
||||
all_total += total
|
||||
if coding.extra_new_work:
|
||||
all_total += coding.extra_new_work
|
||||
if coding.other:
|
||||
all_total += coding.other
|
||||
if all_total:
|
||||
coding.total_day = all_total
|
||||
return coding
|
||||
async def create(self, coding: BillDelayModel):
|
||||
coding = self.create_sum(coding)
|
||||
|
||||
Reference in New Issue
Block a user