Skip to content

Commit

Permalink
Add buttons info in org list tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Shruti1229 committed Jul 24, 2023
1 parent 70b55bb commit 6f19145
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions backend/organization/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ def list_org_tasks(self, request, pk=None, *args, **kwargs):
"Update": False,
"View": False,
"Delete": False,
"Info": False,
"Reopen": False,
}
buttons["Update"] = True
buttons["Delete"] = True
Expand All @@ -397,6 +399,16 @@ def list_org_tasks(self, request, pk=None, *args, **kwargs):
buttons["Edit"] = False
if task["status"] == "POST_PROCESS":
buttons["Update"] = True
if task["status"] == "FAILED":
buttons["Info"] = True
buttons["Reopen"] = True
if task["status"] == "REOPEN":
buttons["Info"] = True
if task["task_type"] == "VOICEOVER_EDIT":
buttons["Preview"] = False
buttons["Info"] = False
if task["status"] == "FAILED":
buttons["Reopen"] = False
if task["user"]["email"] == request.user.email:
if task["status"] not in ["COMPLETE", "POST_PROCESS", "FAILED"]:
buttons["Edit"] = True
Expand Down Expand Up @@ -473,6 +485,8 @@ def list_org_tasks(self, request, pk=None, *args, **kwargs):
"Update": False,
"View": False,
"Delete": False,
"Info": False,
"Reopen": False,
}
if user in task_o.video.project_id.managers.all():
buttons["Update"] = True
Expand All @@ -484,6 +498,16 @@ def list_org_tasks(self, request, pk=None, *args, **kwargs):
buttons["Edit"] = False
if task["status"] == "POST_PROCESS":
buttons["Update"] = True
if task["status"] == "FAILED":
buttons["Info"] = True
buttons["Reopen"] = True
if task["status"] == "REOPEN":
buttons["Info"] = True
if task["task_type"] == "VOICEOVER_EDIT":
buttons["Preview"] = False
buttons["Info"] = False
if task["status"] == "FAILED":
buttons["Reopen"] = False
if task["user"]["email"] == request.user.email:
if task["status"] not in ["COMPLETE", "POST_PROCESS", "FAILED"]:
buttons["Edit"] = True
Expand Down Expand Up @@ -529,6 +553,8 @@ def list_org_tasks(self, request, pk=None, *args, **kwargs):
"Update": False,
"View": False,
"Delete": False,
"Info": False,
"Reopen": False,
}
if task["status"] == "COMPLETE":
buttons["Export"] = True
Expand All @@ -541,6 +567,11 @@ def list_org_tasks(self, request, pk=None, *args, **kwargs):
and task["task_type"] != "VOICEOVER_EDIT"
):
buttons["View"] = True
if task["status"] == "FAILED":
buttons["Info"] = True
if task["task_type"] == "VOICEOVER_EDIT":
buttons["Preview"] = False
buttons["Info"] = False
task["buttons"] = buttons
target_languages_list = list(target_languages)
if "-" in target_languages_list:
Expand Down

0 comments on commit 6f19145

Please sign in to comment.