feat(task-hierarchy): implement recursive task estimation and reset functionality
- Added SQL scripts to fix task hierarchy and reset parent task estimations to zero, ensuring accurate estimation calculations. - Introduced a migration for a recursive task estimation function that aggregates estimations from subtasks, enhancing task management. - Updated controllers to utilize recursive estimations for displaying task data, improving accuracy in task progress representation. - Implemented a new API route to reset parent task estimations, allowing for better task management and data integrity.
This commit is contained in:
29
worklenz-backend/reset-existing-parent-estimations.sql
Normal file
29
worklenz-backend/reset-existing-parent-estimations.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- Reset all existing parent task estimations to 0
|
||||
-- This script updates all tasks that have subtasks to have 0 estimation
|
||||
|
||||
UPDATE tasks
|
||||
SET total_minutes = 0
|
||||
WHERE id IN (
|
||||
SELECT DISTINCT parent_task_id
|
||||
FROM tasks
|
||||
WHERE parent_task_id IS NOT NULL
|
||||
AND archived = false
|
||||
)
|
||||
AND total_minutes > 0
|
||||
AND archived = false;
|
||||
|
||||
-- Show the results
|
||||
SELECT
|
||||
t.id,
|
||||
t.name,
|
||||
t.total_minutes as current_estimation,
|
||||
(SELECT COUNT(*) FROM tasks WHERE parent_task_id = t.id AND archived = false) as subtask_count
|
||||
FROM tasks t
|
||||
WHERE id IN (
|
||||
SELECT DISTINCT parent_task_id
|
||||
FROM tasks
|
||||
WHERE parent_task_id IS NOT NULL
|
||||
AND archived = false
|
||||
)
|
||||
AND archived = false
|
||||
ORDER BY t.name;
|
||||
Reference in New Issue
Block a user