diff --git a/services/plan_service.py b/services/plan_service.py index ddfe21907be40700920e8c3e62ed7a455bc15812..17a127f48d8d74147aeb2294be73ba129a0197b6 100644 --- a/services/plan_service.py +++ b/services/plan_service.py @@ -83,8 +83,8 @@ async def get_plan_by_id(plan_id): if not plan: return ERROR_UN_EXISTED_PLAN, False if plan.status != Status_EN.FINISH.value and plan.tasks: - tasks = await Task.query_obj_all(Task.id.in_(plan.tasks.split(',')), Task.status.in_( - [Status_EN.SUCCESS.value, Status_EN.FAIL.value, Status_EN.SKIP.value])) + end_flags = [Status_EN.SUCCESS.value, Status_EN.FINISH.value, Status_EN.FAIL.value, Status_EN.SKIP.value] + tasks = await Task.query_obj_all(Task.id.in_(plan.tasks.split(',')), Task.status.in_(end_flags)) if len(tasks) == len(plan.tasks.split(',')): plan.status = Status_EN.FINISH.value await plan.update()