Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
fix: Update the status to go with the action
Browse files Browse the repository at this point in the history
  • Loading branch information
robsavoye committed Mar 10, 2024
1 parent b718747 commit 8594b97
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions tm_admin/tasks/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,52 +158,56 @@ async def changeAction(self,
action (Taskaction): The action to change to
Returns:
(bool): Whether locking/unlocking the task was sucessful
(bool): Whether the change was sucessful
"""
# log.warning(f"changeStatus(): unimplemented!")

# the history
history = None
status = None
now = datetime.now()
# All actions get written to the history
history = {"action": action,
"action_text": action.name,
"action_date": '{:%Y-%m-%dT%H:%M:%S}'.format(now),
"user_id": user_id}
# Actions change the status
if action == Taskaction.LOCKED_FOR_MAPPING:
Taskstatus(Taskstatus.TASK_LOCKED_FOR_MAPPING)
history = {"action": action,
"action_text": action.name,
"action_date": '{:%Y-%m-%dT%H:%M:%S}'.format(now),
"user_id": user_id}
status = Taskstatus.TASK_LOCKED_FOR_MAPPING
status = Taskstatus(Taskstatus.TASK_LOCKED_FOR_MAPPING)
elif action == Taskaction.LOCKED_FOR_VALIDATION:
status = Taskstatus.TASK_LOCKED_FOR_VALIDATIONG
status = Taskstatus(Taskstatus.TASK_LOCKED_FOR_VALIDATIONG)
elif action == Taskaction.STATE_CHANGE:
pass
elif action == Taskaction.COMMENT:
pass
elif action == Taskaction.AUTO_UNLOCKED_FOR_MAPPING:
status = Taskstatus.READY
status = Taskstatus(Taskstatus.READY)
elif action == Taskaction.AUTO_UNLOCKED_FOR_VALIDATION:
status = Taskstatus.TASK_LOCKED_FOR_VALIDATION
status = Taskstatus(Taskstatus.TASK_LOCKED_FOR_VALIDATION)
elif action == Taskaction.EXTENDED_FOR_MAPPING:
status = Taskaction.READY # FIXME: Huh ?
status = Taskactipon(Taskaction.READY) # FIXME: Huh ?
elif action == Taskaction.EXTENDED_FOR_VALIDATION:
status = Taskaction.READY # FIXME: Huh ?
status = Taskaction(Taskaction.READY) # FIXME: Huh ?
elif action == Taskaction.RELEASED_FOR_MAPPING:
status = Taskaction.READY # FIXME: Huh ?
status = Taskstatus(Taskaction.READY) # FIXME: Huh ?
elif action == Taskaction.MARKED_MAPPED:
status = Taskaction.TASK_STATUS_MAPPED
status = Taskstatus(Taskaction.TASK_STATUS_MAPPED)
elif action == Taskaction.VALIDATED:
status = Taskaction.VALIDATED
status = Taskstatus(Taskaction.VALIDATED)
elif action == Taskaction.TASK_MARKED_INVALID:
status = Taskaction.TASK_INVALIDATED
status = Taskstatus(Taskaction.TASK_INVALIDATED)
elif action == Taskaction.MARKED_BAD:
# FIXME: this should set the mapping issue
status = Taskaction.READY # FIXME: Huh ?
status = Taskstatus(Taskaction.READY) # FIXME: Huh ?
elif action == Taskaction.SPLIT_NEEDED:
status = Taskaction.SPLIT
status = Taskstatus(Taskaction.SPLIT)
elif action == Taskaction.RECREATED:
status = Taskaction.READY # FIXME: Huh ?
status = Taskstatus(Taskaction.READY) # FIXME: Huh ?

# await self.appendHistory([history], task_id, project_id)
stats = {"task_status": status}
await self.updateColumns(stats,
{"task_id": task_id,
"project_id": project_id})

async def updateHistory(self,
history: list,
Expand Down

0 comments on commit 8594b97

Please sign in to comment.