Indefero

Indefero Commit Details


Date:2011-06-15 04:18:41 (13 years 6 months ago)
Author:William MARTIN
Branch:develop, feature.content-md5, feature.diff-whitespace, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, release-1.2, release-1.3
Commit:ef5b93e3f77fc280ff820a632d3a2c1d8084444b
Parents: 69ae1c08effd703e674afe935898fad397a768da
Message:Fix the special case of a empty issue tracker, for the issue summary.

Changes:

File differences

src/IDF/Views/Issue.php
8484
8585
8686
87
88
89
90
91
8792
8893
8994
90
9195
92
93
94
95
96
97
98
99
100
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
101112
102113
103
104
105
106
107
108
109
114
115
116
117
118
119
110120
111
112
113
114
115
116
117
118
119
120
121
122
123
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
124139
125140
126141
127
128
129
130
131142
143
132144
133145
146
134147
135148
136149
public $summary_precond = array('IDF_Precondition::accessIssues');
public function summary($request, $match)
{
$tagStatistics = array();
$ownerStatistics = array();
$status = array();
$isTrackerEmpty = false;
$prj = $request->project;
$opened = $prj->getIssueCountByStatus('open');
$closed = $prj->getIssueCountByStatus('closed');
$otags = implode(',', $prj->getTagIdsByStatus('open'));
// Issue status statistics
$status = array();
$status['Open'] = array($opened, (int)(100 * $opened / ($opened + $closed)));
$status['Closed'] = array($closed, (int)(100 * $closed / ($opened + $closed)));
// Issue owner statistics
$sqlIssueTable = Pluf::factory('IDF_Issue')->getSqlTable();
$sqlUsersTable = Pluf::factory('Pluf_User')->getSqlTable();
$query = <<<"QUERY"
// Check if the tracker is empty
if ($opened === 0 && $closed === 0) {
$isTrackerEmpty = true;
} else {
if ($opened > 0 || $closed > 0) {
// Issue status statistics
$status['Open'] = array($opened, (int)(100 * $opened / ($opened + $closed)));
$status['Closed'] = array($closed, (int)(100 * $closed / ($opened + $closed)));
}
if ($opened > 0) {
// Issue owner statistics
$sqlIssueTable = Pluf::factory('IDF_Issue')->getSqlTable();
$sqlUsersTable = Pluf::factory('Pluf_User')->getSqlTable();
$otags = implode(',', $prj->getTagIdsByStatus('open'));
$query = <<<"QUERY"
SELECT CONCAT(first_name, " ", last_name) as name, nb FROM (SELECT uid as id,count(uid) as nb FROM (SELECT ifnull(owner, -1) as uid FROM $sqlIssueTable WHERE status IN ($otags)) as ff group by uid) AS ff LEFT JOIN $sqlUsersTable using(id)
QUERY;
$db = Pluf::db();
$dbData = $db->select($query);
$ownerStatistics = array();
foreach ($dbData as $k => $v) {
$key = ($v['name'] === null) ? __('Not assigned') : $v['name'];
$ownerStatistics[$key] = array($v['nb'], (int)(100 * $v['nb'] / $opened));
}
$db = Pluf::db();
$dbData = $db->select($query);
foreach ($dbData as $k => $v) {
$key = ($v['name'] === null) ? __('Not assigned') : $v['name'];
$ownerStatistics[$key] = array($v['nb'], (int)(100 * $v['nb'] / $opened));
}
// Issue class tag statistics
$tags = $prj->getTagCloud();
$tagStatistics = array();
foreach ($tags as $t) {
$tagStatistics[$t->class][$t->name] = array($t->nb_use, $t->id);
}
foreach($tagStatistics as $k => $v) {
$nbIssueInClass = 0;
foreach ($v as $val) {
$nbIssueInClass += $val[0];
}
foreach ($v as $kk => $vv) {
$tagStatistics[$k][$kk] = array($vv[0], (int)(100 * $vv[0] / $nbIssueInClass), $vv[1]);
// Issue class tag statistics
$tags = $prj->getTagCloud();
foreach ($tags as $t) {
$tagStatistics[$t->class][$t->name] = array($t->nb_use, $t->id);
}
foreach($tagStatistics as $k => $v) {
$nbIssueInClass = 0;
foreach ($v as $val) {
$nbIssueInClass += $val[0];
}
foreach ($v as $kk => $vv) {
$tagStatistics[$k][$kk] = array($vv[0], (int)(100 * $vv[0] / $nbIssueInClass), $vv[1]);
}
}
// Sort
krsort($tagStatistics);
arsort($ownerStatistics);
}
}
// Sort
krsort($tagStatistics);
arsort($ownerStatistics);
$title = sprintf(__('Summary of tracked issues in %s.'), (string) $prj);
return Pluf_Shortcuts_RenderToResponse('idf/issues/summary.html',
array('page_title' => $title,
'trackerEmpty' => $isTrackerEmpty,
'project' => $prj,
'tagStatistics' => $tagStatistics,
'ownerStatistics' => $ownerStatistics,
src/IDF/templates/idf/issues/summary.html
33
44
55
6
7
8
9
610
711
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2433
2534
26
27
28
29
30
31
35
3236
3337
3438
3539
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
5362
5463
55
56
57
58
59
60
64
65
6166
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
7889
7990
80
81
82
83
84
85
86
91
92
8793
88
94
8995
{block docclass}yui-t2{assign $inSummaryIssues=true}{/block}
{block body}
{if $trackerEmpty}
{aurl 'create_url', 'IDF_Views_Issue::create', array($project.shortname)}
<p>{blocktrans}The issue tracker is empty<br />You can create your first issue <a href="{$create_url}">here</a>.{/blocktrans}</p>
{else}
<div class='issue-summary'>
{foreach $tagStatistics as $key => $class}
<div>
<h2>Unresolved: By {$key}</h2>
<table class='issue-summary'>
<tbody>
{foreach $class as $key => $value}
<tr>
<td class="name"><a href="{url 'IDF_Views_Issue::listLabel', array($project.shortname, $value[2], 'open')}">{$key}</a></td>
<td class="count">{$value[0]}</td>
<td class="graph">
<table class='graph'>
<tbody><tr>
<td style="width:{$value[1] * 0.8}%" class="graph-color" valign="center">
<div class="colour-bar"></div>
</td>
<td>&nbsp;&nbsp;&nbsp;{$value[1]}%</td>
</tr>
<div>
<h2>Unresolved: By {$key}</h2>
<table class='issue-summary'>
<tbody>
{foreach $class as $key => $value}
<tr>
<td class="name"><a href="{url 'IDF_Views_Issue::listLabel', array($project.shortname, $value[2], 'open')}">{$key}</a></td>
<td class="count">{$value[0]}</td>
<td class="graph">
<table class='graph'>
<tbody><tr>
<td style="width:{$value[1] * 0.8}%" class="graph-color" valign="center">
<div class="colour-bar"></div>
</td>
<td>&nbsp;&nbsp;&nbsp;{$value[1]}%</td>
</tr>
</tbody>
</table>
</td>
</tr>
{/foreach}
</tbody>
</table>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{/foreach}
</div>
<div class='issue-summary'>
<div>
<h2>Status Summary</h2>
<table class='issue-summary'>
<tbody>
{foreach $status as $key => $value}
<tr>
<td class="name"><a href="{url 'IDF_Views_Issue::listStatus', array($project.shortname, $key)}">{$key}</a></td>
<td class="count">{$value[0]}</td>
<td class="graph">
<table class='graph'>
<tbody><tr>
<td style="width:{$value[1] * 0.8}%" class="graph-color" valign="center">
<div class="colour-bar"></div>
</td>
<td>&nbsp;&nbsp;&nbsp;{$value[1]}%</td>
</tr>
{if $status}
<div>
<h2>Status Summary</h2>
<table class='issue-summary'>
<tbody>
{foreach $status as $key => $value}
<tr>
<td class="name"><a href="{url 'IDF_Views_Issue::listStatus', array($project.shortname, $key)}">{$key}</a></td>
<td class="count">{$value[0]}</td>
<td class="graph">
<table class='graph'>
<tbody><tr>
<td style="width:{$value[1] * 0.8}%" class="graph-color" valign="center">
<div class="colour-bar"></div>
</td>
<td>&nbsp;&nbsp;&nbsp;{$value[1]}%</td>
</tr>
</tbody>
</table>
</td>
</tr>
{/foreach}
</tbody>
</table>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{/if}
<div>
<h2>Unresolved: By Assignee</h2>
<table class='issue-summary'>
<tbody>
{foreach $ownerStatistics as $key => $value}
<tr>
<td class="name">{$key}</td>
<td class="count">{$value[0]}</td>
<td class="graph">
<table class='graph'>
<tbody><tr>
<td style="width:{$value[1] * 0.8}%" class="graph-color" valign="center">
<div class="colour-bar"></div>
</td>
<td>&nbsp;&nbsp;&nbsp;{$value[1]}%</td>
</tr>
{if $ownerStatistics}
<div>
<h2>Unresolved: By Assignee</h2>
<table class='issue-summary'>
<tbody>
{foreach $ownerStatistics as $key => $value}
<tr>
<td class="name">{$key}</td>
<td class="count">{$value[0]}</td>
<td class="graph">
<table class='graph'>
<tbody><tr>
<td style="width:{$value[1] * 0.8}%" class="graph-color" valign="center">
<div class="colour-bar"></div>
</td>
<td>&nbsp;&nbsp;&nbsp;{$value[1]}%</td>
</tr>
</tbody>
</table>
</td>
</tr>
{/foreach}
</tbody>
</table>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{/if}
</div>
{/if}
{/block}
www/media/idf/css/style.css
11281128
11291129
11301130
1131
1131
11321132
11331133
11341134
table.issue-summary tr td {
border: 0;
padding: .1em;
padding: .1em .005em;
}
table.issue-summary td.graph {

Archive Download the corresponding diff file

Page rendered in 0.10188s using 13 queries.