* Adjust the summary of the task hours in my module.
This commit is contained in:
@@ -152,6 +152,7 @@
|
||||
</form>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php js::set('tasks', $tasks);?>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
@@ -184,30 +185,12 @@ $(function()
|
||||
}
|
||||
var data = $row.data();
|
||||
taskIdList.push(data.id);
|
||||
|
||||
var status = data.status;
|
||||
if(status === 'wait') checkedWait++;
|
||||
if(status === 'doing') checkedDoing++;
|
||||
|
||||
var canStatistics = false;
|
||||
if(!$row.hasClass('table-children'))
|
||||
{
|
||||
canStatistics = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fix bug #2579. When only child task is checked then statistics it. */
|
||||
var parentID = 0;
|
||||
var classes = $row.attr('class').split(' ');
|
||||
for(i in classes)
|
||||
{
|
||||
if(classes[i].indexOf('parent-') >= 0) parentID = classes[i].replace('parent-', '');
|
||||
}
|
||||
|
||||
if(parentID && taskIdList.indexOf(parseInt(parentID)) < 0) canStatistics = true;
|
||||
}
|
||||
|
||||
if(canStatistics)
|
||||
var parentID = tasks[$row.data('id')].parent;
|
||||
if(parentID <= 0 || !$('tbody>tr[data-id="' + parentID + '"]').length > 0)
|
||||
{
|
||||
checkedEstimate += Number(data.estimate);
|
||||
checkedConsumed += Number(data.consumed);
|
||||
|
||||
@@ -2736,10 +2736,13 @@ class projectModel extends model
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
$totalEstimate += $task->estimate;
|
||||
$totalConsumed += $task->consumed;
|
||||
if(!isset($tasks[$task->parent]) or $task->parent <= 0)
|
||||
{
|
||||
$totalEstimate += $task->estimate;
|
||||
$totalConsumed += $task->consumed;
|
||||
|
||||
if($task->status != 'cancel' and $task->status != 'closed') $totalLeft += $task->left;
|
||||
if($task->status != 'cancel' and $task->status != 'closed') $totalLeft += $task->left;
|
||||
}
|
||||
|
||||
$statusVar = 'status' . ucfirst($task->status);
|
||||
$$statusVar ++;
|
||||
|
||||
Reference in New Issue
Block a user