* finish task #2809.

This commit is contained in:
chenfeiCF
2016-12-20 19:40:08 +08:00
parent 399ad7fcac
commit e0b2e258d5
2 changed files with 27 additions and 3 deletions
+20 -1
View File
@@ -989,12 +989,31 @@ class taskModel extends model
*/
public function getStoryTasks($storyID, $projectID = 0)
{
return $this->dao->select('id, name, assignedTo, pri, status, estimate, consumed, `left`')
$tasks = $this->dao->select('id, name, assignedTo, pri, status, estimate, consumed, `left`')
->from(TABLE_TASK)
->where('story')->eq((int)$storyID)
->andWhere('deleted')->eq(0)
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
->fetchAll('id');
foreach($tasks as $task)
{
/* Compute task progess. */
if($task->consumed == 0 and $task->left == 0)
{
$task->progess = 0;
}
elseif($task->consumed != 0 and $task->left == 0)
{
$task->progess = 100;
}
else
{
$task->progess = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
}
}
return $tasks;
}
/**