From c7e2e99344f9ac49cd664a85193a260bdc37599e Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 1 Oct 2014 14:11:16 +0200 Subject: SONAR-5603 Get issues from E/S in Unresolved Issues per Assignee widget Conflicts: server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexMediumTest.java --- .../issues/UnresolvedIssuesPerAssigneeWidget.java | 2 +- .../issues/unresolved_issues_per_assignee.html.erb | 47 ++++++++++------------ 2 files changed, 22 insertions(+), 27 deletions(-) (limited to 'plugins/sonar-core-plugin') diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java index a8f8e8d41e6..2067c798b99 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/issues/UnresolvedIssuesPerAssigneeWidget.java @@ -25,6 +25,6 @@ import org.sonar.plugins.core.widgets.CoreWidget; @WidgetCategory({"Issues"}) public class UnresolvedIssuesPerAssigneeWidget extends CoreWidget { public UnresolvedIssuesPerAssigneeWidget() { - super("reviews_per_developer", "Unresolved issues per assignee", "/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb"); + super("reviews_per_developer", "Unresolved issues per assignee", "/Users/julienlancelot/Dev/Sources/sonarqube/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb"); } } diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb index 5e1cadae3d9..fec0255334f 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb @@ -1,4 +1,4 @@ -<% +<% options = {} options['resolved'] = 'false' options['componentRoots'] = @project.key @@ -6,35 +6,29 @@ options['createdAfter'] = Api::Utils.format_datetime(@dashboard_configuration.from_datetime) options['createdBefore'] = Api::Utils.format_datetime(DateTime.now) end - results = Internal.issues.findIssueAssignees(options) - assignees = results.results + issues_by_assignee = Internal.issues.findIssueAssignees(options) - unless assignees.empty? - issues_by_assignee = {} - counter_no_assignee = 0 - assignees.each do |assignee| - if assignee - counter = issues_by_assignee[assignee] - if counter - issues_by_assignee[assignee] = counter+1 - else - issues_by_assignee[assignee] = 1 - end - else - counter_no_assignee += 1 - end + unless issues_by_assignee.empty? + users = Internal.users_api.find({'logins', issues_by_assignee.keySet()}) + users_by_login = {} + users.each do |u| + users_by_login[u.login()] = u end + + # puts "### " + users_by_login.inspect + + counter_no_assignee = issues_by_assignee.get(nil) counter_max = 0 - counter_max = issues_by_assignee.values.max unless issues_by_assignee.empty? + counter_max = issues_by_assignee.values().max unless issues_by_assignee.empty? counter_max = counter_no_assignee if counter_no_assignee > counter_max - + div_id = "unresolved-issues-per-assignee-widget-#{widget.id.to_s}" end %>

<%= message('widget.reviews_per_developer.name') -%>

-<% if assignees.size ==0 %> +<% if issues_by_assignee.size ==0 %> <%= message('issue_filter.no_issues') -%> <% else %> @@ -49,11 +43,12 @@ <% - issues_by_assignee.sort{|h1,h2| h2[1] <=> h1[1]}.each do |assignee, count| + issues_by_assignee.each do |assignee, count| + if assignee %> - <%= link_to results.user(assignee).name, url_for_issues(options.merge(:assignees => assignee)) -%> + <%= link_to users_by_login[assignee].name(), url_for_issues(options.merge(:assignees => assignee)) -%> <%= '+' if @dashboard_configuration.selected_period? -%><%= count.to_s -%> @@ -65,9 +60,8 @@ <% end %> <% - end - # And now show the unassigned issues counter - unless counter_no_assignee==0 + # And now show the unassigned issues counter + else %> @@ -82,7 +76,8 @@ <% end %> - <% end %> + <% end + end %> -- cgit v1.2.3