Skip to content

Commit

Permalink
Times now include any subtasks. See JILS-32
Browse files Browse the repository at this point in the history
  • Loading branch information
bentasker committed Sep 18, 2015
1 parent b15b7e9 commit d4d088b
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions issue_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
$relations = $db->loadResults();

// Get Subtasks
$sql = "select a.*,b.* from issuelink as a LEFT JOIN issuelinktype as b ON a.LINKTYPE=b.ID WHERE (a.SOURCE=".(int)$issue->ID . " OR a.DESTINATION=".(int)$issue->ID .
") AND b.OUTWARD = 'jira_subtask_outward'";
$sql = "select a.*,b.* from issuelink as a LEFT JOIN issuelinktype as b ON a.LINKTYPE=b.ID WHERE a.SOURCE=".(int)$issue->ID .
" AND b.OUTWARD = 'jira_subtask_outward'";
$db->setQuery($sql);
$subtasks = $db->loadResults();

Expand Down Expand Up @@ -241,7 +241,28 @@



// Implemented for JILS-32
$TIMESPENT = $issue->TIMESPENT;
$TIMEESTIMATE = $issue->TIMEESTIMATE;
$TIMEORIGINALESTIMATE = $issue->TIMEORIGINALESTIMATE;

if (count($subtasks) > 0){

// Get Subtasks
$sql = "select SUM(c.TIMESPENT) as timespent, SUM(c.TIMEESTIMATE) as timeestimate, SUM(c.TIMEORIGINALESTIMATE) as timeoriginalestimate ".
"from issuelink as a ".
"LEFT JOIN issuelinktype as b ON a.LINKTYPE=b.ID ".
"LEFT JOIN jiraissue as c ON a.DESTINATION = c.ID ".
"WHERE a.SOURCE=".(int)$issue->ID .
" AND b.OUTWARD = 'jira_subtask_outward'";
$db->setQuery($sql);
$subtask_times = $db->loadResult();

$TIMESPENT = $issue->TIMESPENT + $subtask_times->timespent;
$TIMEESTIMATE = $issue->TIMEESTIMATE + $subtask_times->timeestimate;
$TIMEORIGINALESTIMATE = $issue->TIMEORIGINALESTIMATE + $subtask_times->timeoriginalestimate;

}



Expand Down Expand Up @@ -399,7 +420,7 @@ function toggleStatusActivities(){
<div class="leftcol" id="isscreated"><b>Created</b>: <?php echo $issue->CREATED; ?></div>
<div class="rightcol" id="isstimelogged">
<b>Time Spent Working</b><br >
<?php echo createTimeBar($issue->TIMESPENT,$issue->TIMEESTIMATE,$issue->TIMEORIGINALESTIMATE,true) ;?>
<?php echo createTimeBar($TIMESPENT,$TIMEESTIMATE,$TIMEORIGINALESTIMATE,true) ;?>
</div>
</div>
<div class="row">
Expand Down

0 comments on commit d4d088b

Please sign in to comment.