Commit 1a2e11c891ef4a2a87b84f2b0b36316bb809ff14
1 parent
f6a4e563
Exists in
spb-stable
and in
3 other branches
Fix per-project counters for Dashboard filters
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
4 changed files
with
9 additions
and
15 deletions
Show diff stats
app/helpers/dashboard_helper.rb
... | ... | @@ -14,17 +14,11 @@ module DashboardHelper |
14 | 14 | end |
15 | 15 | |
16 | 16 | def entities_per_project(project, entity) |
17 | - items = project.items_for(entity) | |
18 | - | |
19 | - items = case params[:status] | |
20 | - when 'closed' | |
21 | - items.closed | |
22 | - when 'all' | |
23 | - items | |
24 | - else | |
25 | - items.opened | |
26 | - end | |
27 | - | |
28 | - items.cared(current_user).count | |
17 | + case entity.to_sym | |
18 | + when :issue then @issues.where(project_id: project.id) | |
19 | + when :merge_request then @merge_requests.where(target_project_id: project.id) | |
20 | + else | |
21 | + [] | |
22 | + end.count | |
29 | 23 | end |
30 | 24 | end | ... | ... |
app/views/shared/_filter.html.haml
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | Assigned to me |
7 | 7 | %li{class: ("active" if params[:scope] == 'authored')} |
8 | 8 | = link_to filter_path(entity, scope: 'authored') do |
9 | - Authored by me | |
9 | + Created by me | |
10 | 10 | %li{class: ("active" if params[:scope] == 'all')} |
11 | 11 | = link_to filter_path(entity, scope: 'all') do |
12 | 12 | All | ... | ... |
features/steps/dashboard/dashboard_issues.rb
features/steps/dashboard/dashboard_merge_requests.rb