Skip to content

Commit

Permalink
Merge branch 'develop' into const-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ishvindersethi22 authored Jan 5, 2024
2 parents 4ec14d2 + 3348898 commit a78c4a2
Show file tree
Hide file tree
Showing 43 changed files with 1,380 additions and 1,687 deletions.
1 change: 1 addition & 0 deletions src/config/apiendpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const apiendpoint = {
fetch:"/users/account/",
getTasks:"/task/",
getOrganizations:"/organizations/",
notification:"/notifications/",
getLanguages:"/users/languages/",
getDatasets:"/data/",
annotations:"/annotation/",
Expand Down
42 changes: 42 additions & 0 deletions src/redux/actions/api/Notification/Notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* GetOragnizationUsers API
*/
import API from "../../../api";
import ENDPOINTS from "../../../../config/apiendpoint";
import constants from "../../../constants";

export default class NotificationAPI extends API {
constructor( timeout = 2000) {
super("GET", timeout, false);
this.type = constants.NOTIFICATION;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.notification}`;
}

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

apiEndPoint() {
return this.endpoint;
}

getBody() {}

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

getPayload() {
return this.notification;
}
}

47 changes: 47 additions & 0 deletions src/redux/actions/api/Notification/NotificationPatchApi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* GetOragnizationUsers API
*/
import API from "../../../api";
import ENDPOINTS from "../../../../config/apiendpoint";
import constants from "../../../constants";

export default class NotificationPatchAPI extends API {
constructor( id,timeout = 2000) {
super("PATCH", timeout, false);
this.id = id;
this.type = constants.NOTIFICATION;
this.endpoint = `${super.apiEndPointAuto()}/notifications/changeState`;
}

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

apiEndPoint() {
return this.endpoint;
}

getBody() {
return {
notif_id:this.id
}
}

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

getPayload() {
return this.notification;
}
}

7 changes: 5 additions & 2 deletions src/redux/actions/api/Progress/TaskAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import ENDPOINTS from "../../../../config/apiendpoint";
import C from "../../../constants";

export default class TaskAnalyticsDataAPI extends API {
constructor(OrgId,progressObj, timeout = 2000) {
constructor(project_type_filter,progressObj, timeout = 2000) {
super("GET", timeout, false);
this.progressObj = progressObj;
this.type = C.FETCH_TASK_ANALYTICS_DATA;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getOrganizations}public/1/cumulative_tasks_count/`;
project_type_filter=='AllTypes'?
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getOrganizations}public/1/cumulative_tasks_count/`
:
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getOrganizations}public/1/cumulative_tasks_count/?project_type_filter=${project_type_filter}`
}

processResponse(res) {
Expand Down
122 changes: 62 additions & 60 deletions src/redux/actions/api/Tasks/GetTasksByProjectId.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,66 @@
* GetTasksByProjectId
*/

import API from "../../../api";
import ENDPOINTS from "../../../../config/apiendpoint";
import constants from "../../../constants";

export default class GetTasksByProjectIdAPI extends API {
constructor(projectId, pageNo, countPerPage, selectedFilters, taskType, pullvalue,pull, timeout = 2000) {
// console.log(pullvalue,"pullvaluepullvalue")
super("GET", timeout, false);
const datavalue = []
this.type = constants.GET_TASK_LIST;
let queryString = `?project_id=${projectId}${pageNo ? "&page="+pageNo : ""}${countPerPage ?"&records="+countPerPage : ""}`;
let querystr = pull === "All" ?"": `&editable=${pullvalue}`
for (let key in selectedFilters) {
if (selectedFilters[key] && selectedFilters[key] !== -1) {
switch (key) {
case 'annotation_status':
queryString +=`&${key}=["${selectedFilters[key]}"] ${querystr}`
break;
case 'review_status':
queryString +=`&${key}=["${selectedFilters[key]}"] ${querystr}`
break;
case 'supercheck_status':
queryString +=`&${key}=["${selectedFilters[key]}"]`
break;
default:
queryString +=`&${key}=${selectedFilters[key]}`

}
import API from "../../../api";
import ENDPOINTS from "../../../../config/apiendpoint";
import constants from "../../../constants";

export default class GetTasksByProjectIdAPI extends API {
constructor(projectId, pageNo, countPerPage, selectedFilters, taskType, pullvalue,rejected,pull, timeout = 2000) {
// console.log(pullvalue,"pullvaluepullvalue")
super("GET", timeout, false);
const datavalue = []
this.type = constants.GET_TASK_LIST;
let queryString = `?project_id=${projectId}${pageNo ? "&page="+pageNo : ""}${countPerPage ?"&records="+countPerPage : ""}`;
let querystr = pull === "All" ?"": `&editable=${pullvalue}`
let querystr1 = rejected === true ?`&rejected=`+"True":""
for (let key in selectedFilters) {
if (selectedFilters[key] && selectedFilters[key] !== -1) {
switch (key) {
case 'annotation_status':
queryString +=`&${key}=["${selectedFilters[key]}"] ${querystr}${querystr1}`
break;
case 'review_status':
queryString +=`&${key}=["${selectedFilters[key]}"] ${querystr} ${querystr1}`
break;
case 'supercheck_status':
queryString +=`&${key}=["${selectedFilters[key]}"]`
break;
default:
queryString +=`&${key}=${selectedFilters[key]}`

}
}
console.log(queryString);
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getTasks+queryString}`;
}
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.taskList = res;
}
console.log(queryString);
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getTasks+queryString}`;
}
}

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

apiEndPoint() {
return this.endpoint;
}

getBody() {}

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

getPayload() {
return this.taskList
}
}
}

apiEndPoint() {
return this.endpoint;
}

getBody() {}

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

getPayload() {
return this.taskList
}
}

21 changes: 11 additions & 10 deletions src/redux/actions/api/UserManagement/FetchRecentTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
import constants from "../../../constants";

export default class FetchRecentTasksAPI extends API {
constructor(user_id, task_type, pageNo, countPerPage, timeout = 2000) {
constructor(id,task_type, pageNo, filter,countPerPage, timeout = 2000) {
console.log(task_type,"task_typetask_type")
super("POST", timeout, false);
this.userId = user_id;
super("GET", timeout, false);
this.taskType = task_type;
this.id = id;
let queryString = `${pageNo ? "page="+pageNo : ""}${countPerPage ?"&records="+countPerPage : ""}${id ? "&user_id="+id:""}${task_type ? "&task_type="+task_type:""}`;
for (let key in filter) {
if (filter[key] && filter[key] !== -1) {
queryString += `&${key}=${filter[key]}`
}
}
this.type = constants.GET_RECENT_TASKS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getTasks}annotated_and_reviewed_tasks/get_users_recent_tasks/?${pageNo ? "page="+pageNo : ""}${countPerPage ?"&records="+countPerPage : ""}`;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getTasks}annotated_and_reviewed_tasks/get_users_recent_tasks/?${queryString}`;
}

processResponse(res) {
Expand All @@ -27,12 +33,7 @@ import constants from "../../../constants";
return this.endpoint;
}

getBody() {
return {
user_id: this.userId,
task_type: this.taskType,
};
}
getBody() {}

getHeaders() {
this.headers = {
Expand Down
7 changes: 5 additions & 2 deletions src/redux/actions/api/WorkspaceDetails/GetMetaAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import ENDPOINTS from "../../../../config/apiendpoint";
import constants from "../../../constants";

export default class WorkspaceMetaAnalyticsAPI extends API {
constructor(wsId, progressObj, timeout = 2000) {
constructor(wsId, project_type_filter, progressObj, timeout = 2000) {
super("GET", timeout, false);
this.progressObj = progressObj;
this.type = constants.WS_META_ANALYTICS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${wsId}/cumulative_tasks_count_all/?metainfo=true`;
project_type_filter=='AllTypes'?
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${wsId}/cumulative_tasks_count_all/?metainfo=true`
:
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${wsId}/cumulative_tasks_count_all/?metainfo=true&project_type_filter=${project_type_filter}`
}

processResponse(res) {
Expand Down
7 changes: 5 additions & 2 deletions src/redux/actions/api/WorkspaceDetails/GetTaskAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import ENDPOINTS from "../../../../config/apiendpoint";
import constants from "../../../constants";

export default class WorkspaceTaskAnalyticsAPI extends API {
constructor(wsId, timeout = 2000) {
constructor(wsId,project_type_filter, timeout = 2000) {
super("GET", timeout, false);
this.type = constants.WS_TASK_ANALYTICS;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${wsId}/cumulative_tasks_count_all/`;
project_type_filter=='AllTypes'?
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${wsId}/cumulative_tasks_count_all/`
:
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${wsId}/cumulative_tasks_count_all/?project_type_filter=${project_type_filter}`
}

processResponse(res) {
Expand Down
1 change: 1 addition & 0 deletions src/redux/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const constants = {
DELETE_ANNOTATION: "DELETE_ANNOTATION",
GET_NEXT_TASK: "GET_NEXT_TASK",
UPDATE_TASK: "UPDATE_TASK",
NOTIFICATION: "NOTIFICATION",
GET_TASK_ANNOTATIONS: "GET_TASK_ANNOTATIONS",
PULL_NEW_BATCH: "PULL_NEW_BATCH",
PULL_NEW_REVIEW_BATCH: "PULL_NEW_REVIEW_BATCH",
Expand Down
15 changes: 15 additions & 0 deletions src/redux/reducers/Progress/MetaAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ const diffAnnotationReview = (payload) => {
annotation_cumulative_word_count: (value?.ann_cumulative_word_count),
review_cumulative_word_count: (value?.rew_cumulative_word_count),
diff_annotation_review: (value?.ann_cumulative_word_count - value?.rew_cumulative_word_count),

annotation_cumulative_sentance_count: (value?.total_ann_sentance_count),
review_cumulative_sentance_count: (value?.total_rev_sentance_count),
diff_annotation_review_sentance_count: (value?.total_ann_sentance_count - value?.total_rev_sentance_count),

annotation_audio_word_count: (value?.ann_audio_word_count),
review_audio_word_count: (value?.rev_audio_word_count),
diff_annotation_review_audio_word: (value?.ann_audio_word_count - value?.rev_audio_word_count),

annotation_raw_aud_duration:(value?.ann_raw_aud_duration),
review_raw_aud_duration:(value?.rew_raw_aud_duration),
annotation_raw_aud_duration_tohour:(value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),
review_raw_aud_duration_tohour:(value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),
diff_annotation_review_raw_aud_duration_tohour:(value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600 - value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),

annotation_aud_duration:(value?.ann_cumulative_aud_duration),
review_aud_duration:(value?.rew_cumulative_aud_duration),
annotation_aud_duration_tohour:(value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[2]/3600),
Expand Down
15 changes: 15 additions & 0 deletions src/redux/reducers/WorkspaceDetails/GetMetaAnalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ const diffAnnotationReview = (payload) => {
annotation_cumulative_word_count: (value?.ann_cumulative_word_count),
review_cumulative_word_count: (value?.rew_cumulative_word_count),
diff_annotation_review: (value?.ann_cumulative_word_count - value?.rew_cumulative_word_count),

annotation_cumulative_sentance_count: (value?.total_ann_sentance_count),
review_cumulative_sentance_count: (value?.total_rev_sentance_count),
diff_annotation_review_sentance_count: (value?.total_ann_sentance_count - value?.total_rev_sentance_count),

annotation_audio_word_count: (value?.ann_audio_word_count),
review_audio_word_count: (value?.rev_audio_word_count),
diff_annotation_review_audio_word: (value?.ann_audio_word_count - value?.rev_audio_word_count),

annotation_raw_aud_duration:(value?.ann_raw_aud_duration),
review_raw_aud_duration:(value?.rew_raw_aud_duration),
annotation_raw_aud_duration_tohour:(value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),
review_raw_aud_duration_tohour:(value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),
diff_annotation_review_raw_aud_duration_tohour:(value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600 - value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.rew_raw_aud_duration?.split(':')?.map(Number)?.[2]/3600),

annotation_aud_duration:(value?.ann_cumulative_aud_duration),
review_aud_duration:(value?.rew_cumulative_aud_duration),
annotation_aud_duration_tohour:(value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[0] * 1 + value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[1]/ 60 + value?.ann_cumulative_aud_duration?.split(':')?.map(Number)?.[2]/3600),
Expand Down
2 changes: 1 addition & 1 deletion src/ui/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const Layout= (props) => {
{/* {renderSpinner()}
{renderError()} */}
{ Backbutton &&
< BackButton startIcon={< ArrowBackIcon />} sx={{ color:"white" , mb:2 }} backPressNavigationPath={backPressNavigationPath ? backPressNavigationPath : ""} label={translate("label.backToPreviousPage")}/>
< BackButton startIcon={< ArrowBackIcon />} sx={{ color:"white" , mb:2 ,mt:2 }} backPressNavigationPath={backPressNavigationPath ? backPressNavigationPath : ""} label={translate("label.backToPreviousPage")}/>
}
<Suspense fallback={<div>Loading....</div>}>
{component}
Expand Down
Loading

0 comments on commit a78c4a2

Please sign in to comment.