Skip to content

Commit

Permalink
fix: task status updated issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Aug 22, 2023
1 parent b1a3741 commit 5185783
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/backend/app/tasks/tasks_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ def update_task_status(db: Session, user_id: int, task_id: int, new_status: Task
db_task = get_task(db, task_id, db_obj=True)

if db_task:
if (
db_task.task_status
in [TaskStatus.LOCKED_FOR_MAPPING, TaskStatus.LOCKED_FOR_VALIDATION]
) and user_id is not db_task.locked_by:
raise HTTPException(
status_code=401,
detail=f"User {user_id} with username {db_user.username} has not locked this task.",
)
if db_task.task_status in [TaskStatus.LOCKED_FOR_MAPPING, TaskStatus.LOCKED_FOR_VALIDATION]:
if not (
user_id is not db_task.locked_by
):
raise HTTPException(
status_code=401,
detail=f"User {user_id} with username {db_user.username} has not locked this task.",
)

if verify_valid_status_update(db_task.task_status, new_status):
# update history prior to updating task
Expand Down

0 comments on commit 5185783

Please sign in to comment.