Skip to content

Commit

Permalink
feat: added centroids on task details
Browse files Browse the repository at this point in the history
  • Loading branch information
Pradip-p committed Dec 11, 2024
1 parent 2944eb8 commit 2a69ff3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/backend/app/tasks/task_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
async def read_task(
task_id: uuid.UUID,
db: Annotated[Connection, Depends(database.get_db)],
user_data: AuthUser = Depends(login_required),
# user_data: AuthUser = Depends(login_required),
):
"Retrieve details of a specific task by its ID."
return await task_schemas.TaskDetailsOut.get_task_details(db, task_id)
Expand Down
4 changes: 3 additions & 1 deletion src/backend/app/tasks/task_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ class TaskDetailsOut(BaseModel):
side_overlap: Optional[float] = None
gsd_cm_px: Optional[float] = None
gimble_angles_degrees: Optional[int] = None
centroid: dict

@field_validator("state", mode="after")
@classmethod
Expand Down Expand Up @@ -312,7 +313,8 @@ async def get_task_details(db: Connection, task_id: uuid.UUID):
),
'id', tasks.id
) AS outline,
-- Calculate the centroid of the outline
ST_AsGeoJSON(ST_Centroid(tasks.outline))::jsonb AS centroid,
te.created_at,
te.updated_at,
te.state,
Expand Down

0 comments on commit 2a69ff3

Please sign in to comment.