Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add buttons info in org list tasks #404

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading