Add in the beginings of overdue issue display
This commit is contained in:
parent
1b363e4b6d
commit
1d15d53eaa
@ -201,6 +201,28 @@ GROUP BY uid";
|
||||
|
||||
return $ownerStatistics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of overdue/in date issues.
|
||||
*
|
||||
* @param string Status ('open'), 'closed'
|
||||
* @return int Count
|
||||
*/
|
||||
public function getIssueCountByOverdue()
|
||||
{
|
||||
$tags = implode(',', $this->getTagIdsByStatus('open'));
|
||||
$sqlIssueTable = Pluf::factory('IDF_Issue')->getSqlTable();
|
||||
$query = "SELECT (
|
||||
SELECT COUNT(*) FROM $sqlIssueTable
|
||||
WHERE due_dtime < NOW() AND status IN ($tags)
|
||||
) AS overdue,
|
||||
( SELECT COUNT(*) FROM $sqlIssueTable
|
||||
WHERE due_dtime >= NOW() AND status IN ($tags)
|
||||
) AS in_date";
|
||||
$db = Pluf::db();
|
||||
$dbData = $db->select($query);
|
||||
return current($dbData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of open/closed issues.
|
||||
|
@ -122,6 +122,12 @@ class IDF_Views_Issue
|
||||
}
|
||||
arsort($ownerStatistics);
|
||||
|
||||
// Issue due date statistics
|
||||
$overdue = $prj->getIssueCountByOverdue('open');
|
||||
$combined_opened = $overdue['overdue'] + $overdue['in_date'];
|
||||
$duedateStatistics['Overdue'] = array($overdue['overdue'], (int)(100 * $overdue['overdue'] / $combined_opened), 'Overdue');
|
||||
$duedateStatistics['In date'] = array($overdue['in_date'], (int)(100 * $overdue['in_date'] / $combined_opened), 'In date');
|
||||
|
||||
// Issue class tag statistics
|
||||
$grouped_tags = $prj->getTagCloud();
|
||||
foreach ($grouped_tags as $class => $tags) {
|
||||
@ -155,6 +161,7 @@ class IDF_Views_Issue
|
||||
'project' => $prj,
|
||||
'tagStatistics' => $tagStatistics,
|
||||
'ownerStatistics' => $ownerStatistics,
|
||||
'duedateStatistics' => $duedateStatistics,
|
||||
'status' => $status,
|
||||
),
|
||||
$request);
|
||||
@ -790,6 +797,56 @@ class IDF_Views_Issue
|
||||
$request);
|
||||
}
|
||||
|
||||
/**
|
||||
* View list of issues for a given project with a given status.
|
||||
*/
|
||||
public $listOverdue_precond = array('IDF_Precondition::accessIssues');
|
||||
public function listOverdue($request, $match)
|
||||
{
|
||||
$prj = $request->project;
|
||||
$status = $match[2];
|
||||
|
||||
$title = sprintf(__('%s Closed Issues'), (string) $prj);
|
||||
// Get stats about the issues
|
||||
$open = $prj->getIssueCountByStatus('open');
|
||||
$closed = $prj->getIssueCountByStatus('closed');
|
||||
// Paginator to paginate the issues
|
||||
$pag = new Pluf_Paginator(new IDF_Issue());
|
||||
$pag->class = 'recent-issues';
|
||||
$pag->item_extra_props = array('project_m' => $prj,
|
||||
'shortname' => $prj->shortname,
|
||||
'current_user' => $request->user);
|
||||
$pag->summary = __('This table shows the closed issues.');
|
||||
$otags = $prj->getTagIdsByStatus('closed');
|
||||
if (count($otags) == 0) $otags[] = 0;
|
||||
$pag->forced_where = new Pluf_SQL('project=%s AND status IN ('.implode(', ', $otags).')', array($prj->id));
|
||||
$pag->action = array('IDF_Views_Issue::listStatus', array($prj->shortname, $status));
|
||||
$pag->sort_order = array('modif_dtime', 'ASC'); // will be reverted
|
||||
$pag->sort_reverse_order = array('modif_dtime');
|
||||
$pag->sort_link_title = true;
|
||||
$pag->extra_classes = array('a-c', '', 'a-c', '');
|
||||
$list_display = array(
|
||||
'id' => __('Id'),
|
||||
array('summary', 'IDF_Views_Issue_SummaryAndLabels', __('Summary')),
|
||||
array('status', 'IDF_Views_Issue_ShowStatus', __('Status')),
|
||||
array('due_dtime', 'IDF_Views_Issue_DueDate', __('Due Date')),
|
||||
array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')),
|
||||
);
|
||||
$pag->configure($list_display, array(), array('id', 'status', 'due_dtime', 'modif_dtime'));
|
||||
$pag->items_per_page = 10;
|
||||
$pag->no_results_text = __('No issues were found.');
|
||||
$pag->setFromRequest($request);
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/issues/index.html',
|
||||
array('project' => $prj,
|
||||
'page_title' => $title,
|
||||
'open' => $open,
|
||||
'closed' => $closed,
|
||||
'issues' => $pag,
|
||||
'cloud' => 'closed_issues',
|
||||
),
|
||||
$request);
|
||||
}
|
||||
|
||||
/**
|
||||
* View list of issues for a given project with a given label.
|
||||
*/
|
||||
|
@ -103,6 +103,38 @@
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $duedateStatistics}
|
||||
<div>
|
||||
<h2>{blocktrans}Unresolved: By Due Date{/blocktrans}</h2>
|
||||
<table class='issue-summary'>
|
||||
<tbody>
|
||||
{foreach $duedateStatistics as $key => $value}
|
||||
<tr>
|
||||
<td class="name">
|
||||
{if !empty($value[2])}
|
||||
{aurl 'url', 'IDF_Views_Issue::listOverdue', array($project.shortname, $value[2], 'due')}
|
||||
<a href="{$url}">{$key}</a>
|
||||
{else}{$key}{/if}
|
||||
</td>
|
||||
<td class="count">{$value[0]}</td>
|
||||
<td class="graph">
|
||||
<table class='graph'>
|
||||
<tbody><tr>
|
||||
<td style="width:{$value[1] * 0.8 + 1}%" class="graph-color" valign="center">
|
||||
<div class="colour-bar"></div>
|
||||
</td>
|
||||
<td class="graph-percent">{$value[1]}%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
Loading…
Reference in New Issue
Block a user