fix:design progress
This commit is contained in:
@@ -66,7 +66,26 @@ class DesignProgressRepository(BaseRepository[CreateDesignProgress]):
|
|||||||
return await self.get(get_record)
|
return await self.get(get_record)
|
||||||
async def check_complete(self,get_record:GetRecord):
|
async def check_complete(self,get_record:GetRecord):
|
||||||
result = False
|
result = False
|
||||||
if get_record.type and get_record.type < 7:
|
if get_record.type :
|
||||||
|
if get_record.type < 7:
|
||||||
|
progress = await use_collection(COLLECTION).find(
|
||||||
|
{"project_id": get_record.project_id, "type": int(get_record.type)+1}).to_list(None)
|
||||||
|
if progress:
|
||||||
|
ids = [i["_id"] for i in progress]
|
||||||
|
records = await use_collection('design_progress_record').find_one(
|
||||||
|
{"design_progress_id": {"$in":ids}})
|
||||||
|
if records:
|
||||||
|
raise HTTPException(status_code=200, detail='next record is exist')
|
||||||
|
if get_record.type > 1:
|
||||||
|
progress = await use_collection(COLLECTION).find_one(
|
||||||
|
{"project_id": get_record.project_id, "type": int(get_record.type) - 1, "completed_at":{"$exists":1}})
|
||||||
|
if not progress:
|
||||||
|
raise HTTPException(status_code=200, detail='before type not complete')
|
||||||
|
return result
|
||||||
|
|
||||||
|
async def check_create_complete(self,get_record:GetRecord):
|
||||||
|
result = False
|
||||||
|
if get_record.type and get_record.type >1:
|
||||||
progress = await use_collection(COLLECTION).find(
|
progress = await use_collection(COLLECTION).find(
|
||||||
{"project_id": get_record.project_id, "type": int(get_record.type)+1}).to_list(None)
|
{"project_id": get_record.project_id, "type": int(get_record.type)+1}).to_list(None)
|
||||||
if progress:
|
if progress:
|
||||||
|
|||||||
Reference in New Issue
Block a user