From 61a3ffcbd0c6bc696e80268a0edb0dcff099c7c2 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 23 Nov 2016 17:18:12 +0800
Subject: [PATCH 7/9] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E7=BB=9F=E8=AE=A1?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=A1=BA=E5=BA=8F=E6=8C=89=E4=BB=BB=E5=8A=A1?=
=?UTF-8?q?=E9=87=8F=E6=8E=92=E5=BA=8F=EF=BC=8C=E8=B0=83=E6=95=B4total?=
=?UTF-8?q?=E4=BD=8D=E7=BD=AE=E5=92=8C=E6=A0=B7=E5=BC=8F=E5=B9=B6=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E6=9C=AA=E6=8C=87=E6=B4=BE=E4=B8=80=E6=A0=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/issues_controller.rb | 9 ++++++---
app/views/issues/_statistics_all.html.erb | 20 ++++++++++----------
app/views/issues/_statistics_lock.html.erb | 20 ++++++++++----------
app/views/issues/_statistics_open.html.erb | 20 ++++++++++----------
4 files changed, 36 insertions(+), 33 deletions(-)
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index b5e92546f..c6cb018a5 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -102,6 +102,7 @@ class IssuesController < ApplicationController
@issue_count = @query.issue_count
@test = params[:test]
@project_sort = 'issues.updated_on desc'
+
if params[:test] != "0"
case @test
when "1"
@@ -631,7 +632,9 @@ class IssuesController < ApplicationController
end
end
# 搜索结果
- @issues_filter = @query.issues(:order => @project_sort)
+ # SELECT assigned_to_id, count(*) as ac FROM `issues` where project_id = @project.id group by assigned_to_id order by ac desc;
+ @issues_filter = @query.issues.sort_by{ |i| Issue.where(:project_id => @project.id , :assigned_to_id => i.assigned_to_id).count }.reverse
+ # @issues_filter = @query.issues(:order => @project_sort)
# if params[:type] == 1 || params[:type].nil?
# @results = @issues_filter
@@ -669,7 +672,7 @@ class IssuesController < ApplicationController
@alltotal[issue.tracker_id.to_i] = @alltotal[issue.tracker_id.to_i] + 1
user_id = issue.assigned_to_id
if issue.assigned_to_id.nil?
- user_id = issue.author_id
+ user_id = 0
end
if !@results[user_id].nil?
@@ -697,7 +700,7 @@ class IssuesController < ApplicationController
tmpuser = User.find(user_id)
- @results[user_id][:name] = tmpuser.nil? ? " " : tmpuser.show_name
+ @results[user_id][:name] = tmpuser.nil? ? "" : tmpuser.show_name
#所有的
@results[user_id][0] = 1
for i in 1..17 do
diff --git a/app/views/issues/_statistics_all.html.erb b/app/views/issues/_statistics_all.html.erb
index 0ef85057a..b9b593b91 100644
--- a/app/views/issues/_statistics_all.html.erb
+++ b/app/views/issues/_statistics_all.html.erb
@@ -11,9 +11,18 @@
+
+
合计
+
<%= @alltotal[0] %>
+
<%= @alltotal[2] %>
+
<%= @alltotal[4] %>
+
<%= @alltotal[1] %>
+
<%= @alltotal[3] %>
+
<%= @alltotal[5] %>
+
<% @results.each do |k,v|%>
-
<%= v[:name] %>
+
<%= v[:name] =="Anonymous" ? "未指派" : v[:name] %>
<%= v[0] %>
<%= v[2] %>
<%= v[4] %>
@@ -22,14 +31,5 @@
<%= v[5] %>
<% end %>
-
-
Total
-
<%= @alltotal[0] %>
-
<%= @alltotal[2] %>
-
<%= @alltotal[4] %>
-
<%= @alltotal[1] %>
-
<%= @alltotal[3] %>
-
<%= @alltotal[5] %>
-
\ No newline at end of file
diff --git a/app/views/issues/_statistics_lock.html.erb b/app/views/issues/_statistics_lock.html.erb
index f8628144e..edcd9b090 100644
--- a/app/views/issues/_statistics_lock.html.erb
+++ b/app/views/issues/_statistics_lock.html.erb
@@ -11,10 +11,19 @@
+
+
合计
+
<%= @closetotal[0] %>
+
<%= @closetotal[2] %>
+
<%= @closetotal[4] %>
+
<%= @closetotal[1] %>
+
<%= @closetotal[3] %>
+
<%= @closetotal[5] %>
+
<% @results.each do |k,v|%>
<% if v[12] > 0 %>
-
<%= v[:name] %>
+
<%= v[:name] == "Anonymous" ? "未指派" : v[:name] %>
<%= v[12] %>
<%= v[14] %>
<%= v[16] %>
@@ -24,14 +33,5 @@
<% end %>
<% end %>
-
-
Total
-
<%= @closetotal[0] %>
-
<%= @closetotal[2] %>
-
<%= @closetotal[4] %>
-
<%= @closetotal[1] %>
-
<%= @closetotal[3] %>
-
<%= @closetotal[5] %>
-
\ No newline at end of file
diff --git a/app/views/issues/_statistics_open.html.erb b/app/views/issues/_statistics_open.html.erb
index d5eb843f7..e5d07a138 100644
--- a/app/views/issues/_statistics_open.html.erb
+++ b/app/views/issues/_statistics_open.html.erb
@@ -11,10 +11,19 @@
+