diff --git a/backend/video/utils.py b/backend/video/utils.py index 14a8f171..795a368c 100644 --- a/backend/video/utils.py +++ b/backend/video/utils.py @@ -256,9 +256,15 @@ def get_video_func(request): organization = project.organization_id if create: videos = Video.objects.filter(url=url) - for video_organization in videos.values_list("project_id__organization_id__id", flat=True): + for video_organization in videos.values_list( + "project_id__organization_id__id", flat=True + ): if video_organization == organization.id: - video = Video.objects.filter(url=url).filter(project_id__organization_id__id=organization.id).first() + video = ( + Video.objects.filter(url=url) + .filter(project_id__organization_id__id=organization.id) + .first() + ) return Response( { "message": "Video is already a part of project -> {}.".format( @@ -267,6 +273,15 @@ def get_video_func(request): }, status=status.HTTP_400_BAD_REQUEST, ) + + video = ( + Video.objects.filter(url=url) + .filter(project_id__organization_id__id=organization.id) + .first() + ) + if video is None: + create = True + # Convert audio only to boolean is_audio_only = is_audio_only.lower() == "true" multiple_speaker = multiple_speaker.lower() == "true" @@ -713,7 +728,7 @@ def create_video( new_request.GET["task_description"] = task_description new_request.GET["description"] = video_description new_request.GET["ETA"] = ETA - new_request.GET["create"] = "true" + new_request.GET["create"] = "false" new_request.GET["gender"] = gender new_request.GET["assignee"] = assignee new_request.GET["task_type"] = task_type