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