Commit bfccea37 authored by Josh Frye's avatar Josh Frye

Cache assigned open issue count. Closes #18035

parent bffe0d63
...@@ -778,8 +778,14 @@ class User < ActiveRecord::Base ...@@ -778,8 +778,14 @@ class User < ActiveRecord::Base
def assigned_open_merge_request_count def assigned_open_merge_request_count
Rails.cache.fetch(['users', id, 'assigned_open_merge_request_count'], expires_in: 60) do Rails.cache.fetch(['users', id, 'assigned_open_merge_request_count'], expires_in: 60) do
assigned_merge_requests.opened.count assigned_merge_requests.opened.count
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 end
private private
......
...@@ -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