Skip to content

Commit

Permalink
Merge pull request #933 from AI4Bharat/waveSurfer
Browse files Browse the repository at this point in the history
minor changes in autosave
  • Loading branch information
aparna-aa authored Feb 23, 2024
2 parents c019842 + 31fc398 commit 5aa3c89
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const AllAudioTranscriptionLandingPage = () => {
const tasksComplete = (id) => {
if (id) {
navigate(`/projects/${projectId}/AllAudioTranscriptionLandingPage/${id}`);
window.location.reload();
window.location.reload(true);
} else {
setSnackbarInfo({
open: true,
Expand All @@ -187,7 +187,7 @@ const AllAudioTranscriptionLandingPage = () => {
setTimeout(() => {
localStorage.removeItem("labelAll");
window.location.replace(`/#/projects/${projectId}`);
window.location.reload(true);
window.location.reload();
}, 1000);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ const AudioTranscriptionLandingPage = () => {

const handleAutosave = async () => {
setAutoSaveTrigger(false);
if(taskDetails?.task_status !== "labeled"){
if(AnnotationsTaskDetails[0]?.annotation_status !== "labeled"){
if(!autoSave) return;
const reqBody = {
task_id: taskId,
Expand All @@ -315,9 +315,10 @@ const AudioTranscriptionLandingPage = () => {
headers: obj.getHeaders().headers,
});
if (!res.ok) {
const data = await res.json();
setSnackbarInfo({
open: true,
message: "Error in autosaving annotation",
message: data.message,
variant: "error",
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const ReviewAudioTranscriptionLandingPage = () => {

const handleAutosave = async () => {
setAutoSaveTrigger(false);
if(taskDetails?.task_status !== "accepted" && taskDetails?.task_status !== "accepted_with_minor_changes" && taskDetails?.task_status !== "accepted_with_major_changes"){
if(AnnotationsTaskDetails[0]?.annotation_status !== "accepted" && AnnotationsTaskDetails[0]?.annotation_status !== "accepted_with_minor_changes" && AnnotationsTaskDetails[0]?.annotation_status !== "accepted_with_major_changes"){
if(!autoSave) return;
const currentAnnotation = AnnotationsTaskDetails?.find((a) => a.completed_by === user.id && a.annotation_type === 2);
if(!currentAnnotation) return;
Expand All @@ -332,9 +332,10 @@ const ReviewAudioTranscriptionLandingPage = () => {
headers: obj.getHeaders().headers,
});
if (!res.ok) {
const data = await res.json();
setSnackbarInfo({
open: true,
message: "Error in autosaving annotation",
message: data.message,
variant: "error",
});
return res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
const handleAutosave = async () => {
setAutoSaveTrigger(false);
if(taskDetails?.task_status !== "validated" && taskDetails?.task_status !== "validated_with_changes"){
if(AnnotationsTaskDetails[0]?.annotation_status !== "validated" && AnnotationsTaskDetails[0]?.annotation_status !== "validated_with_changes"){
if(!autoSave) return;
const currentAnnotation = AnnotationsTaskDetails?.find((a) => a.completed_by === userData.id && a.annotation_type === 3);
if(!currentAnnotation) return;
Expand All @@ -254,9 +254,10 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
headers: obj.getHeaders().headers,
});
if (!res.ok) {
setSnackbarInfo({
const data = await res.json();
setSnackbarInfo({
open: true,
message: "Error in autosaving annotation",
message: data.message,
variant: "error",
});
}
Expand Down

0 comments on commit 5aa3c89

Please sign in to comment.