simplify the code in IDF_Views_Issue a little

This commit is contained in:
Simon Holywell 2012-04-26 17:18:35 +01:00
parent 53f6133899
commit d348c45c56
2 changed files with 7 additions and 12 deletions

View File

@ -127,11 +127,10 @@ class IDF_Views_Issue
// Issue due date statistics // Issue due date statistics
$overdue = $prj->getIssueCountByDueDate('overdue'); $overdue = $prj->getIssueCountByDueDate('overdue');
$undue = $prj->getIssueCountByDueDate('undue'); $combined_opened = $overdue + $opened;
$combined_opened = $overdue + $undue;
$duedateStatistics = array(); $duedateStatistics = array();
if($combined_opened > 0) { if($combined_opened > 0) {
$duedateStatistics['Overdue'] = array($overdue, (int)(100 * $overdue / $combined_opened), 'Overdue'); $duedateStatistics = array($overdue, (int)(100 * $overdue / $combined_opened));
} }
// Issue class tag statistics // Issue class tag statistics

View File

@ -109,28 +109,24 @@
<h2>{blocktrans}Unresolved: By Due Date{/blocktrans}</h2> <h2>{blocktrans}Unresolved: By Due Date{/blocktrans}</h2>
<table class='issue-summary'> <table class='issue-summary'>
<tbody> <tbody>
{foreach $duedateStatistics as $key => $value}
<tr> <tr>
<td class="name"> <td class="name">
{if !empty($value[2])} {aurl 'url', 'IDF_Views_Issue::listOverdue', array($project.shortname, 'Overdue', 'due')}
{aurl 'url', 'IDF_Views_Issue::listOverdue', array($project.shortname, $value[2], 'due')} <a href="{$url}">{blocktrans}Overdue{/blocktrans}</a>
<a href="{$url}">{$key}</a>
{else}{$key}{/if}
</td> </td>
<td class="count">{$value[0]}</td> <td class="count">{$duedateStatistics[0]}</td>
<td class="graph"> <td class="graph">
<table class='graph'> <table class='graph'>
<tbody><tr> <tbody><tr>
<td style="width:{$value[1] * 0.8 + 1}%" class="graph-color" valign="center"> <td style="width:{$duedateStatistics[1] * 0.8 + 1}%" class="graph-color" valign="center">
<div class="colour-bar"></div> <div class="colour-bar"></div>
</td> </td>
<td class="graph-percent">{$value[1]}%</td> <td class="graph-percent">{$duedateStatistics[1]}%</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</td> </td>
</tr> </tr>
{/foreach}
</tbody> </tbody>
</table> </table>
</div> </div>