Skip to content

Commit

Permalink
Merge branch 'develop' into ocrsegcat1
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikvirendrar authored Mar 20, 2024
2 parents fdb8922 + 1bf2d7c commit 3c25eef
Show file tree
Hide file tree
Showing 26 changed files with 608 additions and 348 deletions.
2 changes: 1 addition & 1 deletion src/config/dropDownValues.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const participationType = ["FULL_TIME", "PART_TIME", "NA"];
export const participationType = ["FULL_TIME", "PART_TIME", "NA", "CONTRACT_BASIS"];
Original file line number Diff line number Diff line change
@@ -1,42 +1,91 @@
import API from "../../../api";
import ENDPOINTS from "../../../../config/apiendpoint";
import constants from "../../../constants";

export default class DeallocationAnnotatorsAndReviewersAPI extends API {
constructor(projectId,radiobutton,annotatorsUser,reviewerssUser,annotationStatus,reviewStatus,superCheckUser,SuperCheckStatus,projectObj, timeout = 2000) {
super("GET", timeout, false);
this.projectObj = projectObj;
const queryString = radiobutton === "annotation" ? `unassign_tasks/?annotator_id=${annotatorsUser}&annotation_status=["${annotationStatus}"]` : radiobutton === "review"? `unassign_review_tasks/?reviewer_id=${reviewerssUser}&review_status=["${reviewStatus}"]`:`unassign_supercheck_tasks/?superchecker_id=${superCheckUser}&supercheck_status=["${SuperCheckStatus}"]`;
console.log(queryString,"queryStringqueryString")
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/${queryString}`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.deallocationAnnotatorsAndReviewers= res;
}
}

apiEndPoint() {
return this.endpoint;
}
getBody() {
return this.projectObj;
}

getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
"Authorization":`JWT ${localStorage.getItem('shoonya_access_token')}`
},
};
return this.headers;
}

getPayload() {
return this.deallocationAnnotatorsAndReviewers
}

export class DeallocateTaskById extends API {
constructor(projectId, taskId, selectedUser, timeout = 2000) {
super("POST", timeout, false);
this.projectId = projectId;

console.log(taskId);
this.payload = {
// task_ids: Array.isArray(taskId) ? taskId.map(id => parseInt(id)) : [parseInt(taskId)],

task_ids: taskId.split(',').map(i => parseInt(i)),
};
const baseEndpoint = `${super.apiEndPointAuto()}/${ENDPOINTS.getProjects}${projectId}/`;

const endpointMap = {
annotation: 'unassign_tasks/',
review: `unassign_review_tasks/`,
superChecker: 'unassign_supercheck_tasks/',
};

const selectedUserEndpoint = endpointMap[selectedUser];

if (selectedUserEndpoint) {
this.endpoint = baseEndpoint + selectedUserEndpoint;
} else {
console.error('Invalid selectedUser:', selectedUser);
}
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.deallocateTaskById = res;
}
}
apiEndPoint() {
return this.endpoint;
}
getBody() {
return this.payload;
}
getHeaders() {
return {
"Content-Type": "application/json",
Authorization: `JWT ${localStorage.getItem("shoonya_access_token")}`,
};
}
getPayload() {
return this.deallocateTaskById;
}
}

export default class DeallocationAnnotatorsAndReviewersAPI extends API {
constructor(projectId,radiobutton,annotatorsUser,reviewerssUser,annotationStatus,reviewStatus,superCheckUser,SuperCheckStatus,projectObj, timeout = 2000) {
super("POST", timeout, false);
this.projectObj = projectObj;
const queryString = radiobutton === "annotation" ? `unassign_tasks/?annotator_id=${annotatorsUser}&annotation_status=["${annotationStatus}"]` : radiobutton === "review"? `unassign_review_tasks/?reviewer_id=${reviewerssUser}&review_status=["${reviewStatus}"]`:`unassign_supercheck_tasks/?superchecker_id=${superCheckUser}&supercheck_status=["${SuperCheckStatus}"]`;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/${queryString}`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.deallocationAnnotatorsAndReviewers= res;
}
}

apiEndPoint() {
return this.endpoint;
}
getBody() {
return this.projectObj;
}


getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
"Authorization":`JWT ${localStorage.getItem('shoonya_access_token')}`
},
};
return this.headers;
}

getPayload() {
return this.deallocationAnnotatorsAndReviewers
}
}
2 changes: 1 addition & 1 deletion src/redux/actions/api/Tasks/DeAllocateSuperCheckerTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import constants from "../../../constants";
export default class DeallocateSuperCheckerTasksAPI extends API {

constructor(projectId,selectedFilters, timeout = 2000) {
super("GET", timeout, false);
super("POST", timeout, false);
this.projectId = projectId;
this.type = constants.DE_ALLOCATE_SUPERCHECKER_TASKS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/unassign_supercheck_tasks/?supercheck_status=['${selectedFilters}']`;
Expand Down
2 changes: 1 addition & 1 deletion src/redux/actions/api/Tasks/DeallocateReviewTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export default class DeallocateReviewTasksAPI extends API {

constructor(projectId,selectedFilters, timeout = 2000) {
super("GET", timeout, false);
super("POST", timeout, false);
this.projectId = projectId;
this.type = constants.DE_ALLOCATE_REVIEW_TASKS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/unassign_review_tasks/?review_status=['${selectedFilters}']`;
Expand Down
2 changes: 1 addition & 1 deletion src/redux/actions/api/Tasks/DeallocateTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

export default class DeallocateTasksAPI extends API {
constructor(projectId,selectedFilters, timeout = 2000) {
super("GET", timeout, false);
super("POST", timeout, false);
this.projectId = projectId;
this.type = constants.DE_ALLOCATE_TASKS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getProjects}${projectId}/unassign_tasks/?annotation_status=['${selectedFilters}']`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const SettingsButtonComponent = ({
checked={enableTransliteration}
onChange={() => {
setAnchorElSettings(null);
localStorage.setItem("userCustomTranscriptionSettings",JSON.stringify({...JSON.parse(localStorage.getItem("userCustomTranscriptionSettings")),"enableTransliteration":!enableTransliteration}))
setTransliteration(!enableTransliteration);
}}
/>
Expand All @@ -155,6 +156,7 @@ const SettingsButtonComponent = ({
checked={enableRTL_Typing}
onChange={() => {
setAnchorElSettings(null);
localStorage.setItem("userCustomTranscriptionSettings",JSON.stringify({...JSON.parse(localStorage.getItem("userCustomTranscriptionSettings")),"enableRTL_Typing":!enableRTL_Typing}))
setRTL_Typing(!enableRTL_Typing);
}}
/>
Expand Down Expand Up @@ -297,6 +299,7 @@ const SettingsButtonComponent = ({
<MenuItem
key={index}
onClick={() => {
localStorage.setItem("userCustomTranscriptionSettings",JSON.stringify({...JSON.parse(localStorage.getItem("userCustomTranscriptionSettings")),"fontSize":item.size}))
setFontSize(item.size);
}}
>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/component/Project/SuperCheckerTasks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ const unassignTasks = async () => {
setDeallocateDialog(false);
const deallocateObj = new DeallocateSuperCheckerTasksAPI(id, selectedFilters.supercheck_status);
const res = await fetch(deallocateObj.apiEndPoint(), {
method: "GET",
method: "POST",
body: JSON.stringify(deallocateObj.getBody()),
headers: deallocateObj.getHeaders().headers,
});
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/component/Project/TaskTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const TaskTable = (props) => {
? new DeallocateTasksAPI(id, selectedFilters.annotation_status)
: new DeallocateReviewTasksAPI(id, selectedFilters.review_status);
const res = await fetch(deallocateObj.apiEndPoint(), {
method: "GET",
method: "POST",
body: JSON.stringify(deallocateObj.getBody()),
headers: deallocateObj.getHeaders().headers,
});
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/component/Tabs/AdvancedOperation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -759,4 +759,4 @@ const AdvancedOperation = (props) => {
);
};

export default AdvancedOperation;
export default AdvancedOperation;
4 changes: 2 additions & 2 deletions src/ui/pages/component/Tabs/MyProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ const MyProgress = () => {
{
label: "Till Date",
range: () => ({
startDate: new Date(Date.parse(UserDetails?.date_joined, 'yyyy-MM-ddTHH:mm:ss.SSSZ')),
startDate: new Date('2021-01-01'),
endDate: new Date(),
}),
isSelected(range) {
Expand All @@ -370,7 +370,7 @@ const MyProgress = () => {
moveRangeOnFirstSelection={false}
months={2}
ranges={selectRange}
minDate={new Date(Date.parse(UserDetails?.date_joined, 'yyyy-MM-ddTHH:mm:ss.SSSZ'))}
minDate={new Date('2021-01-01')}
maxDate={new Date()}
direction="horizontal"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/component/common/DataitemsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ useEffect(() => {
align: "center",
customHeadLabelRender: customColumnHead,
customBodyRender: (value) => {
if ((key == "metadata_json" || key == "prediction_json"|| key == "ocr_prediction_json"|| key == "transcribed_json"|| key == "draft_data_json" || key == "ocr_transcribed_json") && value !== null ) {
if ((key == "metadata_json" || key == "prediction_json"|| key == "ocr_prediction_json"|| key == "transcribed_json"|| key == "draft_data_json" || key == "ocr_transcribed_json" || key == "bboxes_relation_json") && value !== null ) {
const data = JSON.stringify(value)
const metadata = data.replace(/\\/g, "");
return metadata;
Expand Down
10 changes: 9 additions & 1 deletion src/ui/pages/container/Admin/EditProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,15 @@ const EditProfile = (props) => {
id="demo-simple-select-helper"
value={Role}
label="Role"
onChange={(e) => setRole(e.target.value)}
//onChange={(e) => setRole(e.target.value)}
onChange={(e) => {
const newRole = e.target.value;
const currentRole = Role;
if (newRole < currentRole) {
alert("Warning: Demoting someone’s role on the platform may cause inconsistencies and is not advised. Please check with platform admins on this");
}
setRole(newRole);
}}
sx={{
textAlign: "left",
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const AllAudioTranscriptionLandingPage = () => {
const getNextTask = useSelector((state) => state.getnextProject?.data);
const [advancedWaveformSettings, setAdvancedWaveformSettings] = useState(false);
const [assignedUsers, setAssignedUsers] = useState(null);
const [waveSurfer, setWaveSurfer] = useState(true);

const handleCollapseClick = () => {
!showNotes && setShowStdTranscript(false);
Expand Down Expand Up @@ -111,7 +112,12 @@ const AllAudioTranscriptionLandingPage = () => {
variant: "error",
});
} else {
setTaskData(resp)
setTaskData(resp);
if (resp?.data?.audio_duration < 700){
setWaveSurfer(false);
}else{
setWaveSurfer(true);
}
}
setLoading(false);
};
Expand Down Expand Up @@ -334,7 +340,6 @@ const AllAudioTranscriptionLandingPage = () => {
})
}, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]);

const [waveSurfer, setWaveSurfer] = useState(true);
const [waveSurferHeight, setWaveSurferHeigth] = useState(140);
const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100);
const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const AudioTranscriptionLandingPage = () => {
const [advancedWaveformSettings, setAdvancedWaveformSettings] = useState(false);
const [assignedUsers, setAssignedUsers] = useState(null);
const [autoSave, setAutoSave] = useState(true);
const [waveSurfer, setWaveSurfer] = useState(true);
const [autoSaveTrigger, setAutoSaveTrigger] = useState(false);

// useEffect(() => {
Expand Down Expand Up @@ -286,7 +287,12 @@ const AudioTranscriptionLandingPage = () => {
variant: "error",
});
} else {
setTaskData(resp)
setTaskData(resp);
if (resp?.data?.audio_duration < 700){
setWaveSurfer(false);
}else{
setWaveSurfer(true);
}
}
setLoading(false);
};
Expand Down Expand Up @@ -793,7 +799,6 @@ useEffect(() => {
})
}, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]);

const [waveSurfer, setWaveSurfer] = useState(true);
const [waveSurferHeight, setWaveSurferHeigth] = useState(140);
const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100);
const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const ReviewAudioTranscriptionLandingPage = () => {
const [advancedWaveformSettings, setAdvancedWaveformSettings] = useState(false);
const [assignedUsers, setAssignedUsers] = useState(null);
const [autoSave, setAutoSave] = useState(true);
const [waveSurfer, setWaveSurfer] = useState(true);
const [autoSaveTrigger, setAutoSaveTrigger] = useState(false);

// useEffect(() => {
Expand Down Expand Up @@ -302,7 +303,12 @@ const ReviewAudioTranscriptionLandingPage = () => {
message: "Audio Server is down, please try after sometime",
variant: "error",
});
}else(setTaskDetailList(resp))
}else{setTaskDetailList(resp);
if (resp?.data?.audio_duration < 700){
setWaveSurfer(false);
}else{
setWaveSurfer(true);
}}
setLoading(false);
};

Expand Down Expand Up @@ -990,7 +996,6 @@ useEffect(() => {
})
}, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]);

const [waveSurfer, setWaveSurfer] = useState(true);
const [waveSurferHeight, setWaveSurferHeigth] = useState(140);
const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100);
const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
const [advancedWaveformSettings, setAdvancedWaveformSettings] = useState(false);
const [assignedUsers, setAssignedUsers] = useState(null);
const [autoSave, setAutoSave] = useState(true);
const [waveSurfer, setWaveSurfer] = useState(false);
const [autoSaveTrigger, setAutoSaveTrigger] = useState(false);

// useEffect(() => {
Expand Down Expand Up @@ -223,7 +224,12 @@ const SuperCheckerAudioTranscriptionLandingPage = () => {
message: "Audio Server is down, please try after sometime",
variant: "error",
});
}else{setTaskDetailList(resp)}
}else{setTaskDetailList(resp);
if (resp?.data?.audio_duration < 700){
setWaveSurfer(false);
}else{
setWaveSurfer(true);
}}
setLoading(false);
};

Expand Down Expand Up @@ -838,7 +844,6 @@ useEffect(() => {
})
}, [wave, waveColor, backgroundColor, paddingColor, cursor, cursorColor, progress, progressColor, grid, gridColor, ruler, rulerColor, scrollbar, scrollbarColor, rulerAtTop, scrollable, duration, padding, pixelRatio, waveScale, waveSize, wavWorker]);

const [waveSurfer, setWaveSurfer] = useState(true);
const [waveSurferHeight, setWaveSurferHeigth] = useState(140);
const [waveSurferMinPxPerSec, setWaveSurferMinPxPerSec] = useState(100);
const [waveSurferWaveColor, setWaveSurferWaveColor] = useState('#ff4e00');
Expand Down Expand Up @@ -1249,4 +1254,4 @@ useEffect(() => {
</>
);
};
export default SuperCheckerAudioTranscriptionLandingPage;
export default SuperCheckerAudioTranscriptionLandingPage;
Loading

0 comments on commit 3c25eef

Please sign in to comment.