]> source.dussan.org Git - sonarqube.git/blob
46662763c637ce445cf40b28bf9589af67e14440
[sonarqube.git] /
1 <% 
2     options = {}
3     options['resolved'] = 'false'
4     options['componentRoots'] = @project.key
5     if @dashboard_configuration.selected_period?
6       options['createdAfter'] = Api::Utils.format_datetime(@dashboard_configuration.from_datetime)
7       options['createdBefore'] = Api::Utils.format_datetime(DateTime.now)
8     end
9     results = Internal.issues.findIssueAssignees(options)
10     assignees = results.results
11
12     unless assignees.empty?
13       issues_by_assignee = {}
14       counter_no_assignee = 0
15       assignees.each do |assignee|
16         if assignee
17           counter = issues_by_assignee[assignee]
18           if counter
19             issues_by_assignee[assignee] = counter+1
20           else
21             issues_by_assignee[assignee] = 1
22           end
23         else
24           counter_no_assignee += 1
25         end
26       end
27       counter_max = 0
28       counter_max = issues_by_assignee.values.max unless issues_by_assignee.empty?
29       counter_max = counter_no_assignee if counter_no_assignee > counter_max
30       
31       div_id = "unresolved-issues-per-assignee-widget-#{widget.id.to_s}"
32     end
33 %>
34
35 <h3><%= message('widget.reviews_per_developer.name') -%></h3>
36
37 <% if assignees.size ==0 %>
38   <span class="empty_widget"><%= message('widget.reviews_per_developer.name') -%></span>
39
40 <% else %>
41 <div id="<%= div_id -%>">
42
43   <table class="data width100">
44     <thead>
45       <tr>
46         <th coslpan="3">
47         </th>
48       </tr>
49     </thead>
50     <tbody>
51       <%
52          issues_by_assignee.sort{|h1,h2| h2[1] <=> h1[1]}.each do |assignee, count|
53       %>
54         <tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>">
55           <td class="max-width">
56             <%= link_to results.user(assignee).name,
57                         {:controller => 'issues', :action => 'search', :assignees => assignee}.merge(options) -%>
58           </td>
59           <td class="nowrap">
60             <%= '+' if @dashboard_configuration.selected_period? -%><%= count.to_s -%>
61           </td>
62           <% if counter_max > 0 %>
63             <td>
64               <%= barchart(:width => 100, :percent => (100 * count / counter_max).to_i) %>
65             </td>
66           <% end %>
67         </tr>
68       <%
69         end
70         # And now show the unassigned issues counter
71         unless counter_no_assignee==0
72       %>
73         <tr class="<%= cycle 'even', 'odd', :name => (div_id) -%>">
74           <td class="max-width">
75             <%= link_to message('widget.reviews_per_developer.not_assigned'),
76                         {:controller => 'issues', :action => 'search', :assigned => 'false'}.merge(options) -%>
77           </td>
78           <td class="nowrap">
79             <%= '+' if @dashboard_configuration.selected_period? -%><%= counter_no_assignee.to_s -%>
80           </td>
81           <% if counter_max > 0 %>
82             <td>
83               <%= barchart(:width => 100, :percent => (100 * counter_no_assignee / counter_max).to_i) %>
84             </td>
85           <% end %>
86         </tr>
87       <% end %>
88     </tbody>
89   </table>
90
91 </div>
92
93 <% end %>