diff --git a/src/backend/app/projects/project_schemas.py b/src/backend/app/projects/project_schemas.py index 02c1fdaa1d..7fba4a445d 100644 --- a/src/backend/app/projects/project_schemas.py +++ b/src/backend/app/projects/project_schemas.py @@ -28,6 +28,7 @@ from app.models.enums import ProjectPriority, ProjectStatus, TaskSplitType from app.tasks import tasks_schemas from app.users.user_schemas import User +from pydantic.functional_validators import field_validator class ODKCentral(BaseModel): diff --git a/src/backend/app/tasks/tasks_schemas.py b/src/backend/app/tasks/tasks_schemas.py index 9b1e08cbcb..7be5029ba8 100644 --- a/src/backend/app/tasks/tasks_schemas.py +++ b/src/backend/app/tasks/tasks_schemas.py @@ -102,17 +102,17 @@ def get_centroid_from_outline(cls, value: Any, info: ValidationInfo) -> str: return None @field_serializer("locked_by_uid") - def get_lock_uid(self, value: int, info: ValidationInfo) -> str: + def get_locked_by_uid(self, value: str) -> str: """Get lock uid from lock_holder details.""" - if lock_holder := info.data.get("lock_holder"): - return lock_holder.id + if self.lock_holder: + return self.lock_holder.id return None @field_serializer("locked_by_username") - def get_lock_username(self, value: str, info: ValidationInfo) -> str: + def get_locked_by_username(self, value: str) -> str: """Get lock username from lock_holder details.""" - if lock_holder := info.data.get("lock_holder"): - return lock_holder.username + if self.lock_holder: + return self.lock_holder.username return None diff --git a/src/frontend/src/api/Project.js b/src/frontend/src/api/Project.js index 9dac7b9a93..225ec0fc74 100755 --- a/src/frontend/src/api/Project.js +++ b/src/frontend/src/api/Project.js @@ -1,6 +1,7 @@ import { ProjectActions } from '../store/slices/ProjectSlice'; import CoreModules from '../shared/CoreModules'; import environment from '../environment'; +import {task_priority_str} from '../types/enums' export const ProjectById = (existingProjectList, projectId) => { return async (dispatch) => { @@ -20,7 +21,7 @@ export const ProjectById = (existingProjectList, projectId) => { return { id: data.id, project_task_name: data.project_task_name, - task_status: data.task_status, + task_status: task_priority_str[data.task_status], outline_geojson: data.outline_geojson, outline_centroid: data.outline_centroid, task_history: data.task_history, diff --git a/src/frontend/src/api/ProjectTaskStatus.js b/src/frontend/src/api/ProjectTaskStatus.js index c4821ba357..f0e36e27e1 100755 --- a/src/frontend/src/api/ProjectTaskStatus.js +++ b/src/frontend/src/api/ProjectTaskStatus.js @@ -3,6 +3,8 @@ import { easeIn, easeOut } from 'ol/easing'; import { HomeActions } from '../store/slices/HomeSlice'; import CoreModules from '../shared/CoreModules'; import { CommonActions } from '../store/slices/CommonSlice'; +import {task_priority_str} from '../types/enums' + const UpdateTaskStatus = (url, style, existingData, currentProjectId, feature, map, view, taskId, body) => { return async (dispatch) => { const index = existingData.findIndex((project) => project.id == currentProjectId); @@ -14,7 +16,7 @@ const UpdateTaskStatus = (url, style, existingData, currentProjectId, feature, m const findIndexForUpdation = existingData[index].taskBoundries.findIndex((obj) => obj.id == response.data.id); let project_tasks = [...existingData[index].taskBoundries]; - project_tasks[findIndexForUpdation] = { ...response.data }; + project_tasks[findIndexForUpdation] = { ...response.data, task_status: task_priority_str[response.data.task_status] }; let updatedProject = [...existingData]; const finalProjectOBJ = {