fix:design progress

This commit is contained in:
shahzeydyfah
2024-03-23 14:28:05 +03:30
parent 4ca0ea9c8b
commit e438411d29
+7 -5
View File
@@ -67,6 +67,12 @@ class DesignProgressRepository(BaseRepository[CreateDesignProgress]):
async def check_complete(self,get_record:GetRecord):
result = False
if get_record.type :
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')
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)
@@ -76,11 +82,7 @@ class DesignProgressRepository(BaseRepository[CreateDesignProgress]):
{"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):