Merge lp:~raulraat/eventum/raul into lp:eventum

Proposed by Raul Raat
Status: Merged
Merged at revision: 4271
Proposed branch: lp:~raulraat/eventum/raul
Merge into: lp:eventum
Diff against target: 67 lines (+25/-2)
3 files modified
htdocs/view.php (+1/-0)
lib/eventum/class.time_tracking.php (+16/-2)
templates/time_tracking.tpl.html (+8/-0)
To merge this branch: bzr merge lp:~raulraat/eventum/raul
Reviewer Review Type Date Requested Status
Eventum Development Team Pending
Review via email: mp+47526@code.launchpad.net

Commit message

- if multiple users added timetracking to the issue show sum of time spent by user in timetracking section

Description of the change

- if multiple users added timetracking to the issue show sum of time spent by user in timetracking section

To post a comment you must log in.
lp:~raulraat/eventum/raul updated
4272. By Raul Raat

- code formatting

4273. By Raul Raat

- name things the same way everywhere

4274. By Raul Raat

- make total_time_by_user value array

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'htdocs/view.php'
2--- htdocs/view.php 2011-01-20 18:45:20 +0000
3+++ htdocs/view.php 2011-01-26 14:27:14 +0000
4@@ -151,6 +151,7 @@
5 'checkins' => SCM::getCheckinList($issue_id),
6 'time_categories' => Time_Tracking::getAssocCategories(),
7 'time_entries' => $time_entries['list'],
8+ 'total_time_by_user' => $time_entries['total_time_by_user'],
9 'total_time_spent' => $time_entries['total_time_spent'],
10 'impacts' => Impact_Analysis::getListing($issue_id),
11 'statuses' => $statuses,
12
13=== modified file 'lib/eventum/class.time_tracking.php'
14--- lib/eventum/class.time_tracking.php 2010-07-28 08:50:32 +0000
15+++ lib/eventum/class.time_tracking.php 2011-01-26 14:27:14 +0000
16@@ -317,16 +317,30 @@
17 return 0;
18 } else {
19 $total_time_spent = 0;
20+ $total_time_by_user = array();
21 for ($i = 0; $i < count($res); $i++) {
22 $res[$i]["ttr_summary"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["ttr_summary"])));
23 $res[$i]["formatted_time"] = Misc::getFormattedTime($res[$i]["ttr_time_spent"]);
24 $res[$i]["ttr_created_date"] = Date_Helper::getFormattedDate($res[$i]["ttr_created_date"]);
25
26+ if (isset($total_time_by_user[$res[$i]['ttr_usr_id']])) {
27+ $total_time_by_user[$res[$i]['ttr_usr_id']]['time_spent'] += $res[$i]['ttr_time_spent'];
28+ } else {
29+ $total_time_by_user[$res[$i]['ttr_usr_id']] = array(
30+ 'usr_full_name' => $res[$i]['usr_full_name'],
31+ 'time_spent' => $res[$i]['ttr_time_spent']
32+ );
33+ }
34 $total_time_spent += $res[$i]["ttr_time_spent"];
35 }
36+ usort($total_time_by_user, create_function('$a,$b', 'return $a["time_spent"]<$b["time_spent"];'));
37+ foreach ($total_time_by_user as &$item) {
38+ $item['time_spent'] = Misc::getFormattedTime($item['time_spent']);
39+ }
40 return array(
41- "total_time_spent" => Misc::getFormattedTime($total_time_spent),
42- "list" => $res
43+ "total_time_spent" => Misc::getFormattedTime($total_time_spent),
44+ "total_time_by_user" => $total_time_by_user,
45+ "list" => $res
46 );
47 }
48 }
49
50=== modified file 'templates/time_tracking.tpl.html'
51--- templates/time_tracking.tpl.html 2010-10-07 11:42:43 +0000
52+++ templates/time_tracking.tpl.html 2011-01-26 14:27:14 +0000
53@@ -64,6 +64,14 @@
54 <td class="default">{$time_entries[i].ttr_summary}</td>
55 </tr>
56 {if $smarty.section.i.last}
57+ {if count($total_time_by_user) > 1}
58+ {foreach from=$total_time_by_user item=item}
59+ <tr>
60+ <td bgcolor="{$internal_color}" colspan="3" class="default_white" align="right" width="30%">{$item.usr_full_name}:</td>
61+ <td bgcolor="{$dark_color}" colspan="3" class="default" width="70%">{$item.time_spent}</td>
62+ </tr>
63+ {/foreach}
64+ {/if}
65 <tr>
66 <td bgcolor="{$internal_color}" colspan="3" class="default_white" align="right" width="30%">{t}Total Time Spent{/t}:</td>
67 <td bgcolor="{$dark_color}" colspan="3" class="default" width="70%">{$total_time_spent}</td>

Subscribers

People subscribed via source and target branches