Skip to content

Commit

Permalink
Merge pull request #842 from AI4Bharat/uichange2
Browse files Browse the repository at this point in the history
change update time spent timing to 5 minutes for VOTR
  • Loading branch information
aparna-aa authored Nov 9, 2024
2 parents 79a8ccb + 353258f commit 900f952
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
9 changes: 5 additions & 4 deletions src/hooks/useUpdateTimeSpent.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { useEffect } from "react";
import { useRef } from "react";
import { useDispatch } from "react-redux";
import { useDispatch, useSelector } from "react-redux";
import { useParams } from "react-router-dom";
import { APITransportUTS, UpdateTimeSpentPerTask } from "redux/actions";

export const useUpdateTimeSpent = (ref) => {
const { taskId } = useParams();
const timeSpentIntervalRef = useRef(null);
const dispatch = useDispatch();
const taskDetails = useSelector((state) => state.getTaskDetails.data);

useEffect(() => {
const handleUpdateTimeSpent = (time = 60) => {
Expand All @@ -17,14 +18,14 @@ export const useUpdateTimeSpent = (ref) => {

timeSpentIntervalRef.current = setInterval(
handleUpdateTimeSpent,
60 * 1000
taskDetails?.task_type?.includes("VOICEOVER") ? 5 * 60 * 1000 : 60 * 1000
);

const handleVisibilityChange = () => {
if (!document.hidden) {
timeSpentIntervalRef.current = setInterval(
handleUpdateTimeSpent,
60 * 1000
taskDetails?.task_type?.includes("VOICEOVER") ? 5 * 60 * 1000 : 60 * 1000
);
} else {
handleUpdateTimeSpent(ref.current);
Expand All @@ -41,5 +42,5 @@ export const useUpdateTimeSpent = (ref) => {
};

// eslint-disable-next-line
}, []);
}, [taskDetails]);
};
18 changes: 9 additions & 9 deletions src/redux/actions/apitransport/apitransportUts.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ const success = (res, api, dispatch) => {
dispatch(dispatchAPIAsync(api));
}

if (data.message) {
dispatch(
setSnackBar({
open: true,
message: data.message,
variant: "success",
})
);
}
// if (data.message) {
// dispatch(
// setSnackBar({
// open: true,
// message: data.message,
// variant: "success",
// })
// );
// }

if (
typeof api.processNextSuccessStep === "function" &&
Expand Down

0 comments on commit 900f952

Please sign in to comment.