Skip to content

Commit

Permalink
Merge pull request #1073 from AI4Bharat/review-count
Browse files Browse the repository at this point in the history
Review count
  • Loading branch information
aparna-aa authored Jul 8, 2024
2 parents d33763b + 1c7c360 commit f0bbad1
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 3 deletions.
52 changes: 51 additions & 1 deletion src/ui/pages/component/CL-Transcription/ReviewStageButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Alert,
MenuItem,
Menu,
Typography,
} from "@mui/material";
import { useSelector } from "react-redux";
import { useParams } from "react-router-dom";
Expand Down Expand Up @@ -72,6 +73,7 @@ const ReviewStageButtons = ({
const user = useSelector((state) => state.fetchLoggedInUserData?.data);
const getNextTask = useSelector((state) => state.getnextProject?.data);
const taskData = useSelector((state) => state.getTaskDetails?.data);
const ProjectDetails = useSelector((state) => state.getProjectDetails.data);


const open = Boolean(anchorEl);
Expand All @@ -90,6 +92,41 @@ const ReviewStageButtons = ({

return (
<>
<div>
{ProjectDetails.revision_loop_count >
taskData?.revision_loop_count?.review_count
? false
: true && (
<div
style={{
textAlign: "left",
marginBottom: "5px",
marginLeft: "40px",
marginTop: "5px",
}}
>
<Typography variant="body" color="#f5222d">
Note: The 'Revision Loop Count' limit has been reached for
this task.
</Typography>
</div>
)}

{ProjectDetails.revision_loop_count -
taskData?.revision_loop_count?.review_count !==
0 && (
<div
style={{ textAlign: "left", marginLeft: "40px", marginTop: "8px" }}
>
<Typography variant="body" color="#f5222d">
Note: This task can be rejected{" "}
{ProjectDetails.revision_loop_count -
taskData?.revision_loop_count?.review_count}{" "}
more times.
</Typography>
</div>
)}
</div>
<Grid container spacing={1} sx={{ mt: 2, mb: 3, ml: 3 }}>
{!disableBtns && taskData?.review_user === user?.id && (
<Grid item>
Expand Down Expand Up @@ -177,6 +214,12 @@ const ReviewStageButtons = ({
value="to_be_revised"
type="default"
variant="outlined"
disabled={
ProjectDetails.revision_loop_count >
taskData?.revision_loop_count?.review_count
? false
: true
}
onClick={() =>
handleReviewClick(
"to_be_revised",
Expand All @@ -188,7 +231,14 @@ const ReviewStageButtons = ({
style={{
minWidth: "120px",
border: "1px solid gray",
color: "rgb(245, 34, 45)",
color: (
ProjectDetails.revision_loop_count >
taskData?.revision_loop_count?.review_count
? false
: true
)
? "#B2BABB"
: "#f5222d",
pt: 2,
pb: 2,
}}
Expand Down
37 changes: 35 additions & 2 deletions src/ui/pages/container/Label-Studio/ReviewLSF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ useEffect(() => {
selectedLanguages,
ocrDomain
).then((res) => {
if (res.status !== 200) {
if (res?.status !== 200) {
setSnackbarInfo({
open: true,
message: "Error in autosaving annotation",
Expand Down Expand Up @@ -1395,6 +1395,26 @@ useEffect(() => {
Auto-save enabled for this scenario.
</Typography>
</div>}
<div>
{ProjectDetails.revision_loop_count >
taskData?.revision_loop_count?.review_count
? false
: true && (
<div style={{ textAlign: "left", marginBottom: "15px" }}>
<Typography variant="body" color="#f5222d">
Note: The 'Revision Loop Count' limit has been reached for this
task.
</Typography>
</div>
)}

{ProjectDetails.revision_loop_count - taskData?.revision_loop_count?.review_count !== 0 && (
<div style={{ textAlign: "left", marginBottom: "15px" }}>
<Typography variant="body" color="#f5222d">
Note: This task can be rejected {ProjectDetails.revision_loop_count - taskData?.revision_loop_count?.review_count} more times.
</Typography>
</div>)}
</div>
{filterMessage && (
<Alert severity="info" showIcon style={{ marginBottom: "1%" }}>
{filterMessage}
Expand Down Expand Up @@ -1464,10 +1484,23 @@ useEffect(() => {
value="to_be_revised"
type="default"
onClick={handleReviseClick}
disabled={
ProjectDetails.revision_loop_count >
taskData?.revision_loop_count?.review_count
? false
: true
}
style={{
minWidth: "160px",
border: "1px solid #e6e6e6",
color: "#f5222d",
color: (
ProjectDetails.revision_loop_count >
taskData?.revision_loop_count?.review_count
? false
: true
)
? "#B2BABB"
: "#f5222d",
pt: 3,
pb: 3,
borderBottom: "None",
Expand Down

0 comments on commit f0bbad1

Please sign in to comment.