Skip to content

Commit

Permalink
Merge pull request #724 from AI4Bharat/bug-fixes-ap
Browse files Browse the repository at this point in the history
CL-UI timeline fixes
  • Loading branch information
aparna-aa authored Sep 15, 2023
2 parents 8c82c69 + 156de2d commit cee6ad6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 50 deletions.
53 changes: 4 additions & 49 deletions src/ui/pages/container/CL-Transcription/SubtitleBoxes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import React, {
let isDroging = false;

export default memo(
function ({ render, currentTime }) {
function ({ render, currentTime, duration }) {
const { taskId } = useParams();
const classes = AudioTranscriptionLandingStyle();
const dispatch = useDispatch();
Expand Down Expand Up @@ -141,54 +141,11 @@ import React, {
// // eslint-disable-next-line
// }, [result, currentIndex, isPlaying(player)]);

const saveTranscript = async (taskType, result) => {
const reqBody = {
task_id: taskId,
annotation_status: taskData?.annotation_status,
result,
...(( !AnnotationStage||SuperCheckerStage) && {
parent_annotation: taskData?.parent_annotation,
}),
};
if (!textBox && !speakerBox) {
const obj = new SaveTranscriptAPI(taskData?.id,reqBody);
const res = await fetch(obj.apiEndPoint(), {
method: "PATCH",
body: JSON.stringify(obj.getBody()),
headers: obj.getHeaders().headers,
});

const resp = await res.json();
if (!res.ok) {
setSnackbarInfo({
open: true,
message: "Error in autosaving annotation",
variant: "error",
});
}
}{
if (textBox) {
setSnackbarInfo({
open: true,
message: "Please Enter All The Transcripts",
variant: "error",
});
} else if(speakerBox){
setSnackbarInfo({
open: true,
message: "Please Select The Speaker",
variant: "error",
});
}
}
};

const removeSub = useCallback(
(sub) => {
const index = hasSub(sub);
const res = onSubtitleDelete(index);
dispatch(setSubtitles(res, C.SUBTITLES));
//saveTranscript(taskData?.annotation_status, res);
},
// eslint-disable-next-line
[result]
Expand All @@ -199,7 +156,6 @@ import React, {
const index = hasSub(sub);
const res = onMerge(index);
dispatch(setSubtitles(res, C.SUBTITLES));
//saveTranscript(taskData?.annotation_status, res);
},
// eslint-disable-next-line
[result]
Expand All @@ -216,7 +172,6 @@ import React, {

copySub[index] = sub;
dispatch(setSubtitles(copySub, C.SUBTITLES));
//saveTranscript(taskData?.annotation_status,copySub);
},
// eslint-disable-next-line
[result]
Expand Down Expand Up @@ -281,13 +236,13 @@ import React, {
}
} else if (lastType === "right") {
if (endTime >= 0 && endTime - lastSub.startTime >= 0.2) {
const end_time = DT.d2t(endTime);
const end_time = DT.d2t(Math.min(endTime, duration));

if (index >= 0 && index !== result.length - 1 && endTime <= DT.t2d(next.start_time)) {
updateSub(lastSub, { end_time });
}

if(index === result.length - 1 && endTime < lastSub.endTime) {
if(index === result.length - 1) {
updateSub(lastSub, { end_time });
}
} else {
Expand Down
1 change: 1 addition & 0 deletions src/ui/pages/container/CL-Transcription/TimeLine.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ console.log(taskID,"taskDatataskData")
render={render}
playing={playing}
currentTime={currentTime}
duration={player.duration}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ const TranscriptionRightPanel = ({
<Typography
variant="caption"
sx={{p:1, color:"rgb(44, 39, 153)", borderRadius : 2, fontWeight: 600, fontSize: "0.85rem" }}>
Acoustic Transcription
Semantic (L2) Transcription
</Typography>
</Grid>}
</Box>
Expand Down

0 comments on commit cee6ad6

Please sign in to comment.