Commit bfccea37 authored by Josh Frye's avatar Josh Frye

Cache assigned open issue count. Closes #18035

parent bffe0d63
...@@ -782,6 +782,12 @@ class User < ActiveRecord::Base ...@@ -782,6 +782,12 @@ class User < ActiveRecord::Base
end end
end end
def assigned_open_issues_count
Rails.cache.fetch(['users', id, 'assigned_open_issues_count'], expires_in: 60) do
assigned_issues.opened.count
end
end
private private
def projects_union def projects_union
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
= icon('exclamation-circle fw') = icon('exclamation-circle fw')
%span %span
Issues Issues
%span.count= number_with_delimiter(current_user.assigned_issues.opened.count) %span.count= number_with_delimiter(current_user.assigned_open_issues_count)
= nav_link(path: 'dashboard#merge_requests') do = nav_link(path: 'dashboard#merge_requests') do
= link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do
= icon('tasks fw') = icon('tasks fw')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment