You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 3, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 3, 2026. It is now read-only.
Move group aggregated columns calculation logic #852
Currently, we are calculating the group's total area and max time allowed using the aggregated module as it is only used by it introduced in PR#780.
For more consistency, we will have to move this to the project->creation pipeline.
Basic Query needed:
groups_data AS (
SELECTT.project_id,
T.group_id,
SUM( -- sqkm
ST_Area(T.geom::geography(GEOMETRY,4326)) /1000000
) as total_task_group_area,
(
CASE
-- Using 95_percent value of existing data for each project_type
WHEN P.project_type= {Project.Type.BUILD_AREA.value} THEN 1.4
WHEN P.project_type= {Project.Type.COMPLETENESS.value} THEN 1.4
WHEN P.project_type= {Project.Type.CHANGE_DETECTION.value} THEN 11.2-- FOOTPRINT: Not calculated right now
WHEN P.project_type= {Project.Type.FOOTPRINT.value} THEN 6.1
ELSE 1
END
) *COUNT(*) as time_spent_max_allowed
FROM tasks T
INNER JOIN projects P USING (project_id)
WHERET.project_id= %(project_id)s
GROUP BY project_id, P.project_type, group_id
)
UPDATE groups G
SET
total_area =GD.total_task_group_area,
time_spent_max_allowed =GD.time_spent_max_allowedFROM groups_data GD
WHEREG.project_id=GD.project_idANDG.group_id=GD.group_id;
### Tasks
- [ ] Move logic to project->group pipeline
- [ ] Define test cases
Activity