@@ -303,8 +303,8 @@ const SplitTasks = ({ flag, setGeojsonFile, customDataExtractUpload, additionalF
)}
>
)}
- {(splitTasksSelection === task_split_type.divide_on_square ||
- splitTasksSelection === task_split_type.task_splitting_algorithm) && (
+ {(splitTasksSelection === task_split_type.DIVIDE_ON_SQUARE ||
+ splitTasksSelection === task_split_type.TASK_SPLITTING_ALGORITHM) && (
)}
- {(splitTasksSelection === task_split_type.divide_on_square ||
- splitTasksSelection === task_split_type.task_splitting_algorithm ||
- splitTasksSelection === task_split_type.choose_area_as_task) && (
+ {(splitTasksSelection === task_split_type.DIVIDE_ON_SQUARE ||
+ splitTasksSelection === task_split_type.TASK_SPLITTING_ALGORITHM ||
+ splitTasksSelection === task_split_type.CHOOSE_AREA_AS_TASK) && (
Total number of task: {totalSteps}
diff --git a/src/frontend/src/components/createnewproject/validation/DefineTaskValidation.tsx b/src/frontend/src/components/createnewproject/validation/DefineTaskValidation.tsx
index dbd7400041..8037561596 100644
--- a/src/frontend/src/components/createnewproject/validation/DefineTaskValidation.tsx
+++ b/src/frontend/src/components/createnewproject/validation/DefineTaskValidation.tsx
@@ -14,19 +14,19 @@ interface ValidationErrors {
function DefineTaskValidation(values: ProjectValues) {
const errors: ValidationErrors = {};
if (
- values?.task_split_type !== task_split_type.choose_area_as_task &&
- values?.task_split_type !== task_split_type.divide_on_square &&
- values?.task_split_type !== task_split_type.task_splitting_algorithm
+ values?.task_split_type !== task_split_type.CHOOSE_AREA_AS_TASK &&
+ values?.task_split_type !== task_split_type.DIVIDE_ON_SQUARE &&
+ values?.task_split_type !== task_split_type.TASK_SPLITTING_ALGORITHM
) {
errors.task_split_type = 'Splitting Algorithm is required.';
}
- if (values?.task_split_type === task_split_type.divide_on_square && !values?.dimension) {
+ if (values?.task_split_type === task_split_type.DIVIDE_ON_SQUARE && !values?.dimension) {
errors.dimension = 'Dimension is Required.';
}
- if (values?.task_split_type === task_split_type.divide_on_square && values?.dimension && values.dimension < 9) {
+ if (values?.task_split_type === task_split_type.DIVIDE_ON_SQUARE && values?.dimension && values.dimension < 9) {
errors.dimension = 'Dimension should be greater than 10 or equal to 10.';
}
- if (values?.task_split_type === task_split_type.task_splitting_algorithm && !values?.average_buildings_per_task) {
+ if (values?.task_split_type === task_split_type.TASK_SPLITTING_ALGORITHM && !values?.average_buildings_per_task) {
errors.average_buildings_per_task = 'Average number of buildings per task is required.';
}
diff --git a/src/frontend/src/environment.ts b/src/frontend/src/environment.ts
index c66a9e5062..ed07b586e6 100755
--- a/src/frontend/src/environment.ts
+++ b/src/frontend/src/environment.ts
@@ -5,43 +5,45 @@ export default {
return parseInt(binary, 2);
},
encode: (dec) => {
- const desimaal = (dec >>> 0).toString(2);
- return window.btoa(desimaal);
+ const decimal = (dec >>> 0).toString(2);
+ return window.btoa(decimal);
},
matomoTrackingId: '28',
tasksStatus: [
{
- label: 'RELEASED_FOR_MAPPING',
- action: [{ key: 'Start Mapping', value: 'LOCKED_FOR_MAPPING', btnBG: 'red' }],
+ label: 'UNLOCKED_TO_MAP',
+ action: [{ key: 'Start Mapping', value: 'MAP', btnBG: 'red' }],
btnBG: 'red',
},
{
label: 'LOCKED_FOR_MAPPING',
action: [
- { key: 'Mark as fully mapped', value: 'MARKED_MAPPED', btnBG: 'gray' },
- { key: 'Stop Mapping', value: 'RELEASED_FOR_MAPPING', btnBG: 'transparent' },
+ { key: 'Mark as fully mapped', value: 'FINISH', btnBG: 'gray' },
+ { key: 'Stop Mapping', value: 'BAD', btnBG: 'transparent' },
],
},
{
- label: 'MARKED_MAPPED',
+ label: 'UNLOCKED_TO_VALIDATE',
action: [
- { key: 'Start Validation', value: 'LOCKED_FOR_VALIDATION', btnBG: 'gray' },
- // { key: 'Return to Mapping', value: 'LOCKED_FOR_MAPPING' },
+ { key: 'Start Validation', value: 'VALIDATE', btnBG: 'gray' },
+ { key: 'Reset', value: 'BAD' },
],
},
{
label: 'LOCKED_FOR_VALIDATION',
action: [
- { key: 'Mark as validated', value: 'VALIDATED', btnBG: 'gray' },
- { key: 'Mapping Needed', value: 'MARKED_INVALID', btnBG: 'transparent' },
+ { key: 'Mark As Validated', value: 'GOOD', btnBG: 'gray' },
+ { key: 'Mapping Needed', value: 'BAD', btnBG: 'transparent' },
],
},
- { label: 'VALIDATED', action: [] },
- // { label: 'VALIDATED', action: [{ key: 'Merge data with OSM', value: 'MERGE_WITH_OSM', btnBG: 'gray' }] },
- { label: 'MARKED_INVALID', action: [{ key: 'Map Again', value: 'LOCKED_FOR_MAPPING', btnBG: 'gray' }] },
- { label: 'MARKED_BAD', action: [] },
- // "SPLIT",
- // "ARCHIVED",
+ {
+ label: 'UNLOCKED_DONE',
+ action: [
+ { key: 'Reset', value: 'BAD', btnBG: 'gray' },
+ // { key: 'Merge data with OSM', value: 'CONFLATE', btnBG: 'gray' },
+ ],
+ },
+ // TODO add SPLIT, MERGE, ASSIGN
],
baseMapProviders: [
{ id: 1, label: 'ESRI', value: 'esri' },
diff --git a/src/frontend/src/hooks/MapStyles.js b/src/frontend/src/hooks/MapStyles.js
index 84881ee1d8..6a288f5c28 100755
--- a/src/frontend/src/hooks/MapStyles.js
+++ b/src/frontend/src/hooks/MapStyles.js
@@ -54,7 +54,7 @@ export default function MapStyles() {
const redIconStyle = createIconStyle(AssetModules.RedLockPng);
const geojsonStyles = {
- READY: new Style({
+ UNLOCKED_TO_MAP: new Style({
stroke: new Stroke({
color: strokeColor,
width: 3,
@@ -64,7 +64,7 @@ export default function MapStyles() {
}),
}),
LOCKED_FOR_MAPPING: [lockedPolygonStyle, iconStyle],
- MAPPED: new Style({
+ UNLOCKED_TO_VALIDATE: new Style({
stroke: new Stroke({
color: strokeColor,
width: 3,
@@ -74,8 +74,7 @@ export default function MapStyles() {
}),
}),
LOCKED_FOR_VALIDATION: [lockedValidationStyle, redIconStyle],
-
- VALIDATED: new Style({
+ UNLOCKED_DONE: new Style({
stroke: new Stroke({
color: strokeColor,
width: 3,
@@ -84,33 +83,24 @@ export default function MapStyles() {
color: mapTheme.palette.mapFeatureColors.validated_rgb,
}),
}),
- INVALIDATED: new Style({
- stroke: new Stroke({
- color: strokeColor,
- width: 3,
- }),
- fill: new Fill({
- color: mapTheme.palette.mapFeatureColors.invalidated_rgb,
- }),
- }),
- BAD: new Style({
- stroke: new Stroke({
- color: strokeColor,
- width: 3,
- }),
- fill: new Fill({
- color: mapTheme.palette.mapFeatureColors.bad_rgb,
- }),
- }),
- SPLIT: new Style({
- stroke: new Stroke({
- color: strokeColor,
- width: 3,
- }),
- fill: new Fill({
- color: mapTheme.palette.mapFeatureColors.split_rgb,
- }),
- }),
+ // INVALIDATED: new Style({
+ // stroke: new Stroke({
+ // color: strokeColor,
+ // width: 3,
+ // }),
+ // fill: new Fill({
+ // color: mapTheme.palette.mapFeatureColors.invalidated_rgb,
+ // }),
+ // }),
+ // BAD: new Style({
+ // stroke: new Stroke({
+ // color: strokeColor,
+ // width: 3,
+ // }),
+ // fill: new Fill({
+ // color: mapTheme.palette.mapFeatureColors.bad_rgb,
+ // }),
+ // }),
};
setStyle(geojsonStyles);
}, []);
diff --git a/src/frontend/src/models/createproject/createProjectModel.ts b/src/frontend/src/models/createproject/createProjectModel.ts
index a1a4e398cb..91bbec656e 100755
--- a/src/frontend/src/models/createproject/createProjectModel.ts
+++ b/src/frontend/src/models/createproject/createProjectModel.ts
@@ -1,4 +1,4 @@
-import { task_status as taskStatusEnum } from '@/types/enums';
+import { task_state as taskStateEnum } from '@/types/enums';
export interface ProjectDetailsModel {
id: number;
@@ -36,13 +36,13 @@ export interface ProjectDetailsModel {
id: string;
bbox: null | number[];
};
- task_status: taskStatusEnum;
+ task_state: taskStateEnum;
actioned_by_uid: number;
actioned_by_username: string;
task_history: {
event_id: string;
- action_text: string;
- action_date: string;
+ state: string;
+ comment: string;
}[];
qr_code_base64: string;
}[];
diff --git a/src/frontend/src/models/project/projectModel.ts b/src/frontend/src/models/project/projectModel.ts
index 136cba8285..79518ce134 100644
--- a/src/frontend/src/models/project/projectModel.ts
+++ b/src/frontend/src/models/project/projectModel.ts
@@ -11,32 +11,13 @@ export type dataExtractPropertyType = {
};
export type taskHistoryTypes = {
- action_date: string;
- action_text: string;
- id: number;
- profile_img: null | string;
- status: string;
+ event_id: string;
+ event: number;
+ state: string;
+ comment: string;
username: string;
-};
-
-export type taskHistoryListType = {
- action: string;
- action_date: string;
- action_text: string;
- project_id: number;
- outlineGeojson: {
- type: string;
- geometry: {
- coordinates: [];
- type: string;
- };
- properties: Record;
- id: string;
- };
profile_img: null | string;
- status: string;
- task_id: number;
- username: string;
+ created_at: string;
};
export type projectInfoType = {
@@ -111,7 +92,7 @@ export type taskBoundriesTypes = {
bbox: null | number[];
};
task_history: taskHistoryTypes[];
- task_status: string;
+ task_state: string;
};
export type taskBoundriesGeojson = {
diff --git a/src/frontend/src/store/slices/ProjectSlice.ts b/src/frontend/src/store/slices/ProjectSlice.ts
index 583c50634b..342cc2f200 100755
--- a/src/frontend/src/store/slices/ProjectSlice.ts
+++ b/src/frontend/src/store/slices/ProjectSlice.ts
@@ -32,7 +32,7 @@ const initialState: ProjectStateTypes = {
},
entityOsmMap: [],
entityOsmMapLoading: false,
- updateEntityStatusLoading: false,
+ updateEntityStateLoading: false,
projectDashboardLoading: false,
geolocationStatus: false,
projectCommentsList: [],
@@ -143,10 +143,10 @@ const ProjectSlice = createSlice({
UpdateProjectTaskActivity(state, action) {
state.projectTaskActivity = [action.payload, ...state.projectTaskActivity];
},
- UpdateEntityStatusLoading(state, action) {
- state.updateEntityStatusLoading = action.payload;
+ UpdateEntityStateLoading(state, action) {
+ state.updateEntityStateLoading = action.payload;
},
- UpdateEntityStatus(state, action) {
+ UpdateEntityState(state, action) {
const updatedEntityOsmMap = state.entityOsmMap?.map((entity) => {
if (entity.id === action.payload.id) {
return action.payload;
@@ -159,10 +159,10 @@ const ProjectSlice = createSlice({
const updatedProjectTaskBoundries = state.projectTaskBoundries?.map((boundary) => {
if (boundary.id == action.payload.projectId) {
const updatedBoundary = boundary?.taskBoundries?.map((taskBoundary) => {
- if (taskBoundary?.index === +action.payload.taskId) {
+ if (taskBoundary?.id === +action.payload.taskId) {
return {
...taskBoundary,
- task_status: action.payload.task_status,
+ task_state: action.payload.task_state,
actioned_by_uid: action.payload.actioned_by_uid,
actioned_by_username: action.payload.actioned_by_username,
};
diff --git a/src/frontend/src/store/slices/SubmissionSlice.ts b/src/frontend/src/store/slices/SubmissionSlice.ts
index 46e46e2a22..f42559ec2a 100644
--- a/src/frontend/src/store/slices/SubmissionSlice.ts
+++ b/src/frontend/src/store/slices/SubmissionSlice.ts
@@ -27,7 +27,7 @@ const initialState: SubmissionStateTypes = {
taskId: null,
projectId: null,
reviewState: '',
- taskUId: null,
+ taskUid: null,
},
updateReviewStateLoading: false,
};
diff --git a/src/frontend/src/store/types/ICreateProject.ts b/src/frontend/src/store/types/ICreateProject.ts
index a964f94570..797efb53ff 100644
--- a/src/frontend/src/store/types/ICreateProject.ts
+++ b/src/frontend/src/store/types/ICreateProject.ts
@@ -60,7 +60,7 @@ export type ProjectTaskTypes = {
index: number;
project_id: number;
outline: GeoJSONFeatureTypes;
- task_status: number;
+ task_state: string;
actioned_by_uid: number | null;
actioned_by_username: string | null;
task_history: any[];
diff --git a/src/frontend/src/store/types/IProject.ts b/src/frontend/src/store/types/IProject.ts
index 27c6a10b21..db6be9ccac 100644
--- a/src/frontend/src/store/types/IProject.ts
+++ b/src/frontend/src/store/types/IProject.ts
@@ -26,7 +26,7 @@ export type ProjectStateTypes = {
projectDashboardDetail: projectDashboardDetailTypes;
entityOsmMap: EntityOsmMap[];
entityOsmMapLoading: boolean;
- updateEntityStatusLoading: boolean;
+ updateEntityStateLoading: boolean;
projectDashboardLoading: boolean;
geolocationStatus: boolean;
projectCommentsList: projectCommentsListTypes[];
@@ -57,23 +57,20 @@ type tilesListTypes = {
type projectCommentsListTypes = {
id: number;
- project_id: number;
- action: string;
- action_text: string;
- action_date: string;
- username: string;
task_id: number;
+ comment: string;
+ created_at: string;
+ username: string;
profile_img: string;
- status: any;
};
export type projectTaskActivity = {
- id: number;
+ event_id: string;
task_id: number;
- action: string;
- action_text: string;
- action_date: string;
- status: string;
+ event: string;
+ state: string;
+ comment: string;
profile_img: null | string;
username: string;
+ created_at: string;
};
diff --git a/src/frontend/src/store/types/ISubmissions.ts b/src/frontend/src/store/types/ISubmissions.ts
index dde7ec2a05..dd2f63c956 100644
--- a/src/frontend/src/store/types/ISubmissions.ts
+++ b/src/frontend/src/store/types/ISubmissions.ts
@@ -24,7 +24,7 @@ type updateReviewStatusModal = {
taskId: string | null;
projectId: number | null;
reviewState: string;
- taskUId: string | null;
+ taskUid: string | null;
};
export type filterType = {
diff --git a/src/frontend/src/types/enums.ts b/src/frontend/src/types/enums.ts
index 39c44f3d43..6f5417f4d8 100644
--- a/src/frontend/src/types/enums.ts
+++ b/src/frontend/src/types/enums.ts
@@ -1,20 +1,34 @@
export enum task_split_type {
- divide_on_square = 'DIVIDE_ON_SQUARE',
- choose_area_as_task = 'CHOOSE_AREA_AS_TASK',
- task_splitting_algorithm = 'TASK_SPLITTING_ALGORITHM',
+ DIVIDE_ON_SQUARE = 'DIVIDE_ON_SQUARE',
+ CHOOSE_AREA_AS_TASK = 'CHOOSE_AREA_AS_TASK',
+ TASK_SPLITTING_ALGORITHM = 'TASK_SPLITTING_ALGORITHM',
}
-export enum task_status {
- RELEASED_FOR_MAPPING = 'RELEASED_FOR_MAPPING',
+export enum task_event {
+ MAP = 'MAP',
+ FINISH = 'FINISH',
+ VALIDATE = 'VALIDATE',
+ GOOD = 'GOOD',
+ BAD = 'BAD',
+ SPLIT = 'SPLIT',
+ MERGE = 'MERGE',
+ ASSIGN = 'ASSIGN',
+ COMMENT = 'COMMENT',
+}
+
+export enum task_state {
+ UNLOCKED_TO_MAP = 'UNLOCKED_TO_MAP',
LOCKED_FOR_MAPPING = 'LOCKED_FOR_MAPPING',
- MARKED_MAPPED = 'MARKED_MAPPED',
+ UNLOCKED_TO_VALIDATE = 'UNLOCKED_TO_VALIDATE',
LOCKED_FOR_VALIDATION = 'LOCKED_FOR_VALIDATION',
- VALIDATED = 'VALIDATED',
- MARKED_INVALID = 'MARKED_INVALID',
- MARKED_BAD = 'MARKED_BAD',
- SPLIT_NEEDED = 'SPLIT_NEEDED',
- RECREATED = 'RECREATED',
- COMMENT = 'COMMENT',
+ UNLOCKED_DONE = 'UNLOCKED_DONE',
+}
+
+export enum entity_state {
+ READY = 0,
+ OPENED_IN_ODK = 1,
+ SURVEY_SUBMITTED = 2,
+ MARKED_BAD = 6,
}
export enum user_roles {
diff --git a/src/frontend/src/utilfunctions/getTaskStatusStyle.ts b/src/frontend/src/utilfunctions/getTaskStatusStyle.ts
index 256a77e60e..d7f5bb4c1f 100644
--- a/src/frontend/src/utilfunctions/getTaskStatusStyle.ts
+++ b/src/frontend/src/utilfunctions/getTaskStatusStyle.ts
@@ -2,7 +2,7 @@ import { Fill, Icon, Stroke, Style } from 'ol/style';
import { getCenter } from 'ol/extent';
import { Point } from 'ol/geom';
import AssetModules from '@/shared/AssetModules';
-import { task_status } from '@/types/enums';
+import { entity_state } from '@/types/enums';
import { EntityOsmMap } from '@/store/types/IProject';
function createPolygonStyle(fillColor: string, strokeColor: string) {
@@ -38,7 +38,7 @@ const strokeColor = 'rgb(0,0,0,0.3)';
const secondaryStrokeColor = 'rgb(0,0,0,1)';
const getTaskStatusStyle = (feature: Record, mapTheme: Record, taskLockedByUser: boolean) => {
- const status = feature.getProperties().task_status;
+ const status = feature.getProperties().task_state;
const isTaskStatusLocked = ['LOCKED_FOR_MAPPING', 'LOCKED_FOR_VALIDATION'].includes(status);
const borderStrokeColor = isTaskStatusLocked && taskLockedByUser ? secondaryStrokeColor : strokeColor;
@@ -55,7 +55,7 @@ const getTaskStatusStyle = (feature: Record, mapTheme: Record, mapTheme: Record, mapTheme: Record, mapTheme: Record, entityOsmMap: EntityOsmMap[]) => {
const entity = entityOsmMap?.find((entity) => entity?.osm_id === osmId) as EntityOsmMap;
- let status = task_status[entity?.status];
+
+ let status = entity_state[entity?.status];
const borderStrokeColor = '#FF0000';
@@ -143,19 +134,18 @@ export const getFeatureStatusStyle = (osmId: string, mapTheme: Record {
geometry: { ...taskObj.outline },
properties: {
...taskObj.outline.properties,
- task_status: taskObj?.task_status,
+ task_state: taskObj?.task_state,
actioned_by_uid: taskObj?.actioned_by_uid,
actioned_by_username: taskObj?.actioned_by_username,
},
diff --git a/src/frontend/src/views/SubmissionDetails.tsx b/src/frontend/src/views/SubmissionDetails.tsx
index e3d3274890..8c2e57f903 100644
--- a/src/frontend/src/views/SubmissionDetails.tsx
+++ b/src/frontend/src/views/SubmissionDetails.tsx
@@ -2,7 +2,7 @@ import CoreModules from '@/shared/CoreModules.js';
import React, { useEffect } from 'react';
import { SubmissionService } from '@/api/Submission';
import SubmissionInstanceMap from '@/components/SubmissionMap/SubmissionInstanceMap';
-import { GetProjectDashboard } from '@/api/Project';
+import { GetSubmissionDashboard } from '@/api/Project';
import Button from '@/components/common/Button';
import { SubmissionActions } from '@/store/slices/SubmissionSlice';
import UpdateReviewStatusModal from '@/components/ProjectSubmissions/UpdateReviewStatusModal';
@@ -89,7 +89,7 @@ const SubmissionDetails = () => {
const projectId = params.projectId;
const paramsInstanceId = params.instanceId;
- const taskUId = params.taskId;
+ const taskUid = params.taskId;
const projectDashboardDetail = useAppSelector((state) => state.project.projectDashboardDetail);
const projectDashboardLoading = useAppSelector((state) => state.project.projectDashboardLoading);
const submissionDetails = useAppSelector((state) => state.submission.submissionDetails);
@@ -100,7 +100,7 @@ const SubmissionDetails = () => {
const dateDeviceDetails = { start, end, today, deviceid };
useEffect(() => {
- dispatch(GetProjectDashboard(`${import.meta.env.VITE_API_URL}/projects/project_dashboard/${projectId}`));
+ dispatch(GetSubmissionDashboard(`${import.meta.env.VITE_API_URL}/submission/${projectId}/dashboard`));
}, []);
useEffect(() => {
@@ -110,13 +110,14 @@ const SubmissionDetails = () => {
}, [projectId, paramsInstanceId]);
useEffect(() => {
- if (!taskUId) return;
+ // Note here taskUid is coerced to string so we have to check that
+ if (taskUid == 'undefined') return;
dispatch(
GetProjectComments(
- `${import.meta.env.VITE_API_URL}/tasks/${parseInt(taskUId)}/history/?project_id=${projectId}&comment=true`,
+ `${import.meta.env.VITE_API_URL}/tasks/${parseInt(taskUid)}/history/?project_id=${projectId}&comments=true`,
),
);
- }, [taskUId]);
+ }, [taskUid]);
const filteredData = restSubmissionDetails ? removeNullValues(restSubmissionDetails) : {};
@@ -219,7 +220,7 @@ const SubmissionDetails = () => {
projectId: projectId,
taskId: taskId,
reviewState: restSubmissionDetails?.__system?.reviewState,
- taskUId: taskUId,
+ taskUid: taskUid,
}),
);
}}
diff --git a/src/mapper/package.json b/src/mapper/package.json
index d20ac5a909..f39da71c65 100644
--- a/src/mapper/package.json
+++ b/src/mapper/package.json
@@ -18,7 +18,7 @@
"electric:migrations": "electric-sql generate"
},
"devDependencies": {
- "@playwright/test": "^1.44.1",
+ "@playwright/test": "^1.48.1",
"@sveltejs/adapter-auto": "^3.2.2",
"@sveltejs/kit": "^2.5.24",
"@sveltejs/vite-plugin-svelte": "3.1.2",
diff --git a/src/mapper/pnpm-lock.yaml b/src/mapper/pnpm-lock.yaml
index 3229a51e89..e189ba0e00 100644
--- a/src/mapper/pnpm-lock.yaml
+++ b/src/mapper/pnpm-lock.yaml
@@ -55,8 +55,8 @@ importers:
version: 10.0.0
devDependencies:
'@playwright/test':
- specifier: ^1.44.1
- version: 1.44.1
+ specifier: ^1.48.1
+ version: 1.48.2
'@sveltejs/adapter-auto':
specifier: ^3.2.2
version: 3.2.2(@sveltejs/kit@2.5.24(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.3.1(@types/node@20.14.8)))(svelte@4.2.19)(vite@5.3.1(@types/node@20.14.8)))
@@ -553,9 +553,9 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
- '@playwright/test@1.44.1':
- resolution: {integrity: sha512-1hZ4TNvD5z9VuhNJ/walIjvMVvYkZKf71axoF/uiAqpntQJXpG64dlXhoDXE3OczPuTuvjf/M5KWFg5VAVUS3Q==}
- engines: {node: '>=16'}
+ '@playwright/test@1.48.2':
+ resolution: {integrity: sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw==}
+ engines: {node: '>=18'}
hasBin: true
'@polka/url@1.0.0-next.25':
@@ -2207,14 +2207,14 @@ packages:
pkg-types@1.1.1:
resolution: {integrity: sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==}
- playwright-core@1.44.1:
- resolution: {integrity: sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA==}
- engines: {node: '>=16'}
+ playwright-core@1.48.2:
+ resolution: {integrity: sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA==}
+ engines: {node: '>=18'}
hasBin: true
- playwright@1.44.1:
- resolution: {integrity: sha512-qr/0UJ5CFAtloI3avF95Y0L1xQo6r3LQArLIg/z/PoGJ6xa+EwzrwO5lpNr/09STxdHuUoP2mvuELJS+hLdtgg==}
- engines: {node: '>=16'}
+ playwright@1.48.2:
+ resolution: {integrity: sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ==}
+ engines: {node: '>=18'}
hasBin: true
pmtiles@3.0.6:
@@ -3293,9 +3293,9 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.17.1
- '@playwright/test@1.44.1':
+ '@playwright/test@1.48.2':
dependencies:
- playwright: 1.44.1
+ playwright: 1.48.2
'@polka/url@1.0.0-next.25': {}
@@ -5046,11 +5046,11 @@ snapshots:
mlly: 1.7.1
pathe: 1.1.2
- playwright-core@1.44.1: {}
+ playwright-core@1.48.2: {}
- playwright@1.44.1:
+ playwright@1.48.2:
dependencies:
- playwright-core: 1.44.1
+ playwright-core: 1.48.2
optionalDependencies:
fsevents: 2.3.2
diff --git a/src/mapper/src/lib/components/event-card.svelte b/src/mapper/src/lib/components/event-card.svelte
index 91e0bb1332..77c84988ff 100644
--- a/src/mapper/src/lib/components/event-card.svelte
+++ b/src/mapper/src/lib/components/event-card.svelte
@@ -45,16 +45,16 @@
- {record?.action} by {record.action_text?.split(' ').at(-1)}
+ {record?.event} by {record.comment?.split(' ').at(-1)}
-
+
#{record?.task_id}
- {#if record?.action_date}
- {@const formattedDate = formatDate(record.action_date)}
+ {#if record?.created_at}
+ {@const formattedDate = formatDate(record.created_at)}
{formattedDate.date}
{formattedDate.time}
{:else}
diff --git a/src/mapper/src/lib/task-events.ts b/src/mapper/src/lib/task-events.ts
index cba1324964..6f42a38e4d 100644
--- a/src/mapper/src/lib/task-events.ts
+++ b/src/mapper/src/lib/task-events.ts
@@ -1,6 +1,6 @@
import { v4 as uuidv4 } from 'uuid';
import { TaskStatusEnum } from '$lib/types';
-import type { TaskStatus, TaskEvent } from '$lib/types';
+import type { MappingState, TaskEvent } from '$lib/types';
const API_URL = import.meta.env.VITE_API_URL;
@@ -10,17 +10,17 @@ export function statusEnumLabelToValue(statusLabel: string): string {
if (!(statusLabel in TaskStatusEnum)) {
throw new Error(`Invalid status string: ${statusLabel}`);
}
- const statusValue = TaskStatusEnum[statusLabel as keyof TaskStatus];
+ const statusValue = TaskStatusEnum[statusLabel as keyof MappingState];
return statusValue;
}
-export function statusEnumValueToLabel(statusValue: string): keyof TaskStatus {
+export function statusEnumValueToLabel(statusValue: string): keyof MappingState {
// Validate if statusValue exists in TaskStatusEnum
const statusEntry = Object.entries(TaskStatusEnum).find(([_, value]) => value === statusValue);
if (statusEntry) {
- return statusEntry[0] as keyof TaskStatus;
+ return statusEntry[0] as keyof MappingState;
} else {
throw new Error(`Invalid status value: ${statusValue}`);
}
@@ -38,7 +38,7 @@ async function add_event(
taskId: number,
// userId: number,
actionId: string,
- // action_text: string = '',
+ // comment: string = '',
// ): Promise
{
): Promise {
// const eventId = uuidv4()
@@ -56,14 +56,14 @@ async function add_event(
return newEvent;
// // Uncomment this for local first approach
- // await db.task_history.create({
+ // await db.task_events.create({
// data: {
// event_id: uuidv4(),
// project_id: projectId,
// task_id: taskId,
- // action: action,
- // action_text: action_text,
- // action_date: new Date().toISOString(),
+ // event: action,
+ // comment: comment,
+ // created_at: new Date().toISOString(),
// user_id: userId,
// },
// });
@@ -74,22 +74,22 @@ export async function mapTask(/* db, */ projectId: number, taskId: number): Prom
}
export async function finishTask(/* db, */ projectId: number, taskId: number): Promise {
- // TODO the backend /new-status endpoint is actually posting TaskStatus
- // TODO it should likely be posting TaskAction (TaskEvent) to the endpoint
+ // TODO the backend /new-status endpoint is actually posting MappingState
+ // TODO it should likely be posting TaskEvent (TaskEvent) to the endpoint
// TODO then we handle the status of the task internally
// i.e. it's duplicated info!
- await add_event(/* db, */ projectId, taskId, TaskStatusEnum.MARKED_MAPPED);
+ await add_event(/* db, */ projectId, taskId, TaskStatusEnum.UNLOCKED_TO_VALIDATE);
}
export async function resetTask(/* db, */ projectId: number, taskId: number): Promise {
- await add_event(/* db, */ projectId, taskId, TaskStatusEnum.RELEASED_FOR_MAPPING);
+ await add_event(/* db, */ projectId, taskId, TaskStatusEnum.UNLOCKED_TO_MAP);
}
// async function finishTask(db, projectId: number, taskId: number, userId: number): Promise {
// // const query = `
// // WITH last AS (
// // SELECT *
-// // FROM task_history
+// // FROM task_events
// // WHERE project_id = ? AND task_id = ?
// // ORDER BY aid DESC
// // LIMIT 1
@@ -99,15 +99,15 @@ export async function resetTask(/* db, */ projectId: number, taskId: number): Pr
// // FROM last
// // WHERE user_id = ? AND action = 'LOCKED_FOR_MAPPING'
// // )
-// // INSERT INTO task_history (
+// // INSERT INTO task_events (
// // event_id, project_id, task_id, action,
-// // action_text, action_date, user_id
+// // comment, created_at, user_id
// // )
// // SELECT
// // ?, -- event_id
// // ?, -- project_id
// // ?, -- task_id
-// // 'MARKED_MAPPED',
+// // 'UNLOCKED_TO_VALIDATE',
// // 'Note: Mapping finished',
// // ?
// // user_id
@@ -136,7 +136,7 @@ export async function resetTask(/* db, */ projectId: number, taskId: number): Pr
// // assert(newEvent.task_id === taskId);
// // assert(newEvent.user_id === userId);
-// await add_event(db, projectId, taskId, userId, 'MARKED_MAPPED');
+// await add_event(db, projectId, taskId, userId, 'UNLOCKED_TO_VALIDATE');
// }
// async function validateTask(db, projectId: number, taskId: number, userId: number): Promise {
diff --git a/src/mapper/src/lib/types.ts b/src/mapper/src/lib/types.ts
index e290315beb..5c876f547c 100644
--- a/src/mapper/src/lib/types.ts
+++ b/src/mapper/src/lib/types.ts
@@ -56,32 +56,29 @@ export interface ZoomToTaskEventDetail {
}
export type TaskStatus = {
- RELEASED_FOR_MAPPING: string;
+ UNLOCKED_TO_MAP: string;
LOCKED_FOR_MAPPING: string;
- MARKED_MAPPED: string;
+ UNLOCKED_TO_VALIDATE: string;
LOCKED_FOR_VALIDATION: string;
- VALIDATED: string;
- INVALIDATED: string;
- BAD: string;
- SPLIT: string;
- ARCHIVED: string;
+ UNLOCKED_DONE: string;
+ // INVALIDATED: string;
+ // BAD: string;
+ // SPLIT: string;
+ // ARCHIVED: string;
};
export const TaskStatusEnum: TaskStatus = Object.freeze({
- RELEASED_FOR_MAPPING: '0',
- LOCKED_FOR_MAPPING: '1',
- MARKED_MAPPED: '2',
- LOCKED_FOR_VALIDATION: '3',
- VALIDATED: '4',
- INVALIDATED: '5',
- BAD: '6',
- SPLIT: '7',
- ARCHIVED: '8',
+ UNLOCKED_TO_MAP: 'UNLOCKED_TO_MAP',
+ LOCKED_FOR_MAPPING: 'LOCKED_FOR_MAPPING',
+ UNLOCKED_TO_VALIDATE: 'UNLOCKED_TO_VALIDATE',
+ LOCKED_FOR_VALIDATION: 'LOCKED_FOR_VALIDATION',
+ UNLOCKED_DONE: 'UNLOCKED_DONE',
});
+// TODO fix me
export type TaskEvent = {
event_id: string;
- action_text: string;
- action_date: string;
+ comment: string;
+ created_at: string;
username: string;
profile_img: string;
status: TaskStatus;
diff --git a/src/mapper/src/routes/[projectId]/+page.svelte b/src/mapper/src/routes/[projectId]/+page.svelte
index 0a8bcc8bd6..09105901ff 100644
--- a/src/mapper/src/routes/[projectId]/+page.svelte
+++ b/src/mapper/src/routes/[projectId]/+page.svelte
@@ -65,7 +65,7 @@
// *** Task history sync *** //
const taskFeatcolStore = writable({ type: 'FeatureCollection', features: [] });
const taskHistoryStream = new ShapeStream({
- url: 'http://localhost:7055/v1/shape/task_history',
+ url: 'http://localhost:7055/v1/shape/task_events',
where: `project_id=${data.projectId}`,
});
const taskHistoryEvents = new Shape(taskHistoryStream);
@@ -86,7 +86,7 @@
for (const taskData of taskEventArrayFromApi) {
// Use the task_id as the key and action as the value
- latestActions.set(taskData.task_id, taskData.action);
+ latestActions.set(taskData.task_id, taskData.event);
}
return latestActions;
@@ -130,7 +130,7 @@
if (task && task.id) {
const latestActions = await getLatestEventForTasks();
const statusLabel = latestActions.get(task.id);
- selectedTaskStatus.set(statusLabel ? statusLabel : 'RELEASED_FOR_MAPPING');
+ selectedTaskStatus.set(statusLabel ? statusLabel : 'UNLOCKED_TO_MAP');
} else {
selectedTaskStatus.set('');
}
@@ -293,12 +293,12 @@
{#if $latestEvent}
- Latest: {$latestEvent.action_text}
+ Latest: {$latestEvent.comment}
{/if}
{#if $selectedTaskId}
- {#if $selectedTaskStatus == 'RELEASED_FOR_MAPPING'}
+ {#if $selectedTaskStatus == 'UNLOCKED_TO_MAP'}
- {:else if $selectedTaskStatus == 'MARKED_MAPPED'}
+ {:else if $selectedTaskStatus == 'UNLOCKED_TO_VALIDATE'}
- {#if $selectedTaskId && selectedTab === 'map' && toggleTaskActionModal && ($selectedTaskStatus === 'RELEASED_FOR_MAPPING' || $selectedTaskStatus === 'LOCKED_FOR_MAPPING')}
+ {#if $selectedTaskId && selectedTab === 'map' && toggleTaskActionModal && ($selectedTaskStatus === 'UNLOCKED_TO_MAP' || $selectedTaskStatus === 'LOCKED_FOR_MAPPING')}
- {#if $selectedTaskStatus == 'RELEASED_FOR_MAPPING'}
+ {#if $selectedTaskStatus == 'UNLOCKED_TO_MAP'}
Do you want to start mapping task #{$selectedTaskId}?