feat(report):add design_progress_status_state
This commit is contained in:
@@ -29,6 +29,7 @@ class CreateDesignProgress(pydantic.BaseModel):
|
|||||||
6.تائید دانشگاه علوم پزشکی
|
6.تائید دانشگاه علوم پزشکی
|
||||||
7.گزارش های کلیه رشته ها
|
7.گزارش های کلیه رشته ها
|
||||||
""")
|
""")
|
||||||
|
state:Optional[str]
|
||||||
|
|
||||||
class UpdateDesignProgress(pydantic.BaseModel):
|
class UpdateDesignProgress(pydantic.BaseModel):
|
||||||
complete_at: Optional[datetime.datetime] = Field(description='تاریخ تکمیل مدارک')
|
complete_at: Optional[datetime.datetime] = Field(description='تاریخ تکمیل مدارک')
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from uuid import UUID
|
|||||||
|
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
|
|
||||||
|
from app.config import TaskEnv
|
||||||
from app.models.design_progress import DesignProgressModel, CreateDesignProgress, RecordModel, GetRecord, \
|
from app.models.design_progress import DesignProgressModel, CreateDesignProgress, RecordModel, GetRecord, \
|
||||||
UpdateDesignProgress
|
UpdateDesignProgress
|
||||||
from core.repositories.base import BaseRepository
|
from core.repositories.base import BaseRepository
|
||||||
@@ -24,11 +25,13 @@ class DesignProgressRepository(BaseRepository):
|
|||||||
"sub_type": _inp.sub_type
|
"sub_type": _inp.sub_type
|
||||||
})
|
})
|
||||||
if not exist:
|
if not exist:
|
||||||
|
project = await use_collection(TaskEnv.CLN_PROJECT).find_one({"_id":_inp.project_id})
|
||||||
progress = DesignProgressModel(
|
progress = DesignProgressModel(
|
||||||
project_id=_inp.project_id,
|
project_id=_inp.project_id,
|
||||||
type=_inp.type,
|
type=_inp.type,
|
||||||
parent_id=_inp.parent_id,
|
parent_id=_inp.parent_id,
|
||||||
sub_type=_inp.sub_type,
|
sub_type=_inp.sub_type,
|
||||||
|
state = project['design']['state']
|
||||||
)
|
)
|
||||||
progress.init_id().cu_at()
|
progress.init_id().cu_at()
|
||||||
await use_collection(COLLECTION).insert_one(progress.mongo_dict())
|
await use_collection(COLLECTION).insert_one(progress.mongo_dict())
|
||||||
|
|||||||
@@ -421,4 +421,16 @@ class ReportRepository():
|
|||||||
]).to_list(None)
|
]).to_list(None)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
async def design_progress_status_state(self):
|
||||||
|
result = await use_collection("design_progress").aggregate([
|
||||||
|
{'$match':{'complete_at':{"$exists":0},'parent_id':{"$exists":0}}},
|
||||||
|
{"$group":
|
||||||
|
{'_id': {'state':"$state",'type':'$type'},
|
||||||
|
'count': {'$sum': 1},
|
||||||
|
"projectIds": {"$addToSet": "$project_id"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]).to_list(None)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -112,4 +112,9 @@ def progress_month_report(_inp:PhysicalMonth = Body(...)):
|
|||||||
def design_progress_status():
|
def design_progress_status():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@router.get('/design_progress/status/state', tags=_tag_base)
|
||||||
|
@shrink(repo.design_progress_status_state)
|
||||||
|
def design_progress_status_state():
|
||||||
|
pass
|
||||||
|
|
||||||
app.include_router(router)
|
app.include_router(router)
|
||||||
Reference in New Issue
Block a user