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

added condition for voiceover disable and small check for translation… #547

Closed
Closed
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
22 changes: 19 additions & 3 deletions backend/task/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2885,6 +2885,22 @@ def reopen_translation_task(self, request, pk, *args, **kwargs):
status=status.HTTP_400_BAD_REQUEST,
)
if task.status == "COMPLETE" and "TRANSLATION" in task.task_type:
translation_review_task=(
Task.objects.filter(video=task.video)
.filter(target_language=task.target_language)
.filter(task_type="TRANSLATION_REVIEW")
.first()
)
if (
"TRANSLATION_EDIT" in task.task_type
and translation_review_task is not None
and translation_review_task.is_active==True
):
return Response(
{"message": "Can not reopen this task. Corrosponding Translation Review task is active"},
status=status.HTTP_400_BAD_REQUEST,
)

voiceover_task = (
Task.objects.filter(video=task.video)
.filter(target_language=task.target_language)
Expand Down Expand Up @@ -2964,9 +2980,9 @@ def reopen_translation_task(self, request, pk, *args, **kwargs):
task.status = "REOPEN"
task.save()

voice_over_selected_source_obj.translation = None
voice_over_selected_source_obj.payload = {"payload": {"completed_count": 0}}
voice_over_selected_source_obj.save()
voice_over_selected_source_obj.delete()
voiceover_task.is_active = False
voiceover_task.save()

else:
return Response(
Expand Down