Skip to content

Commit

Permalink
bug fixes for paraphrase task
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikvirendrar committed Sep 3, 2024
1 parent 1ee97c9 commit 734f153
Showing 1 changed file with 53 additions and 3 deletions.
56 changes: 53 additions & 3 deletions backend/transcript/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1744,11 +1744,61 @@ def save_transcription(request):
task.video.project_id.paraphrasing_enabled
and transcript.paraphrase_stage != True
):
transcript_obj = (
Transcript.objects.filter(status=TRANSCRIPTION_EDIT_INPROGRESS)
.filter(video=task.video)
.first()
)

tc_status = TRANSCRIPTION_EDIT_INPROGRESS
if transcript_obj is not None:
modify_payload(
offset,
limit,
payload,
start_offset,
end_offset,
transcript_obj,
)
# transcript_obj.payload = payload
transcript_obj.transcript_type = transcript_obj.transcript_type
transcript_obj.save()
else:
transcript_obj = (
Transcript.objects.filter(
status=TRANSCRIPTION_SELECT_SOURCE
)
.filter(video=task.video)
.first()
)
if transcript_obj is None:
return Response(
{"message": "Transcript object does not exist."},
status=status.HTTP_404_NOT_FOUND,
)

transcript_obj = Transcript.objects.create(
transcript_type=transcript_obj.transcript_type,
parent_transcript=transcript_obj,
video=task.video,
language=transcript_obj.language,
payload=transcript_obj.payload,
user=request.user,
task=task,
status=tc_status,
)
modify_payload(
offset,
limit,
payload,
start_offset,
end_offset,
transcript_obj,
)
transcript_obj.save()
task.status = "POST PROCESS"
task.save()
update_transcript_paraphrases(transcript)

transcript_obj = transcript
update_transcript_paraphrases(transcript_obj)
else:
if (
Transcript.objects.filter(
Expand Down

0 comments on commit 734f153

Please sign in to comment.