Fixed sub-task handling

The previous implementation of sub-tasks did not work as expected: it
was possible to mark sub-tasks as completed before the parent task's
dependencies were satisfied. In addition, it was impossible to retrieve
a task's path from the database without running a recursive query.

Full paths to sub-tasks added to views, since it is now possible to
obtain them.
This commit is contained in:
Emmanuel BENOîT 2012-02-15 10:04:11 +01:00
parent 91ae4f81fd
commit 2051303262
13 changed files with 1023 additions and 224 deletions
includes/t-data

View file

@ -175,10 +175,10 @@ class DAO_Items
}
$query = $this->query(
'SELECT p.item_id , p.item_name , p.item_description , COUNT(*) AS t_count '
'SELECT p.item_id , p.item_name , p.item_description , COUNT(*) AS t_count_all , '
. 'COUNT( NULLIF( t.task_id_parent IS NULL , FALSE ) ) AS t_count '
. 'FROM items p '
. 'INNER JOIN task_containers USING ( item_id ) '
. 'INNER JOIN tasks t USING( tc_id ) '
. 'INNER JOIN tasks t USING( item_id ) '
. 'LEFT OUTER JOIN completed_tasks c ON t.task_id = c.task_id '
. 'WHERE c.task_id IS NULL '
. 'GROUP BY item_id, p.item_name' );
@ -193,6 +193,7 @@ class DAO_Items
$this->loaded[ $entry->item_id ] = $object;
}
$object->activeTasks = $entry->t_count;
$object->activeTasksTotal = $entry->t_count_all;
}
$this->activeTasksCounted = true;