diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-21 16:45:42 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-21 16:45:42 +0000 |
commit | d6c6c7ac62bf3cf0003cc950880de5597611eb1d (patch) | |
tree | d9d52c47042ae8b959ebb4f4bb2454f2f6629a4e | |
parent | e643ea9b9148edc4cfefe0f536e7372dbe31584a (diff) | |
download | redmine-d6c6c7ac62bf3cf0003cc950880de5597611eb1d.tar.gz redmine-d6c6c7ac62bf3cf0003cc950880de5597611eb1d.zip |
Use the same scope for counting.
git-svn-id: http://svn.redmine.org/redmine/trunk@14719 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/my_helper.rb | 8 | ||||
-rw-r--r-- | app/views/my/blocks/_issuesassignedtome.html.erb | 6 | ||||
-rw-r--r-- | app/views/my/blocks/_issuesreportedbyme.html.erb | 6 | ||||
-rw-r--r-- | app/views/my/blocks/_issueswatched.html.erb | 7 |
4 files changed, 13 insertions, 14 deletions
diff --git a/app/helpers/my_helper.rb b/app/helpers/my_helper.rb index 0f4f7b835..acb9d836e 100644 --- a/app/helpers/my_helper.rb +++ b/app/helpers/my_helper.rb @@ -37,8 +37,7 @@ module MyHelper limit(10). includes(:status, :project, :tracker, :priority). references(:status, :project, :tracker, :priority). - order("#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC"). - to_a + order("#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC") end def issuesreportedbyme_items @@ -47,12 +46,11 @@ module MyHelper limit(10). includes(:status, :project, :tracker). references(:status, :project, :tracker). - order("#{Issue.table_name}.updated_on DESC"). - to_a + order("#{Issue.table_name}.updated_on DESC") end def issueswatched_items - Issue.visible.on_active_project.watched_by(User.current.id).recently_updated.limit(10).to_a + Issue.visible.on_active_project.watched_by(User.current.id).recently_updated.limit(10) end def news_items diff --git a/app/views/my/blocks/_issuesassignedtome.html.erb b/app/views/my/blocks/_issuesassignedtome.html.erb index f408111a3..94948b7aa 100644 --- a/app/views/my/blocks/_issuesassignedtome.html.erb +++ b/app/views/my/blocks/_issuesassignedtome.html.erb @@ -1,11 +1,11 @@ +<% assigned_issues = issuesassignedtome_items %> <h3> <%= link_to l(:label_assigned_to_me_issues), issues_path(:set_filter => 1, :assigned_to_id => 'me', :sort => 'priority:desc,updated_on:desc') %> - (<%= Issue.visible.open.where(:assigned_to_id => ([User.current.id] + User.current.group_ids)).count %>) + (<%= assigned_issues.limit(nil).count %>) </h3> -<% assigned_issues = issuesassignedtome_items %> -<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %> +<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues.to_a } %> <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, diff --git a/app/views/my/blocks/_issuesreportedbyme.html.erb b/app/views/my/blocks/_issuesreportedbyme.html.erb index 3064675f2..5b0e5b2d4 100644 --- a/app/views/my/blocks/_issuesreportedbyme.html.erb +++ b/app/views/my/blocks/_issuesreportedbyme.html.erb @@ -1,11 +1,11 @@ +<% reported_issues = issuesreportedbyme_items %> <h3> <%= link_to l(:label_reported_issues), issues_path(:set_filter => 1, :status_id => '*', :author_id => 'me', :sort => 'updated_on:desc') %> - (<%= Issue.visible.where(:author_id => User.current.id).count %>) + (<%= reported_issues.limit(nil).count %>) </h3> -<% reported_issues = issuesreportedbyme_items %> -<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %> +<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues.to_a } %> <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, diff --git a/app/views/my/blocks/_issueswatched.html.erb b/app/views/my/blocks/_issueswatched.html.erb index 6984526c9..512a52238 100644 --- a/app/views/my/blocks/_issueswatched.html.erb +++ b/app/views/my/blocks/_issueswatched.html.erb @@ -1,8 +1,9 @@ +<% watched_issues = issueswatched_items %> <h3> <%= link_to l(:label_watched_issues), issues_path(:set_filter => 1, :watcher_id => 'me', :sort => 'updated_on:desc') %> - (<%= Issue.visible.watched_by(user.id).count %>) + (<%= watched_issues.limit(nil).count %>) </h3> -<% watched_issues = issueswatched_items %> -<%= render :partial => 'issues/list_simple', :locals => { :issues => watched_issues } %> + +<%= render :partial => 'issues/list_simple', :locals => { :issues => watched_issues.to_a } %> |