OSDN Git Service

Fix per-project counters for Dashboard filters
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Wed, 25 Dec 2013 07:19:51 +0000 (09:19 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Wed, 25 Dec 2013 07:19:51 +0000 (09:19 +0200)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/helpers/dashboard_helper.rb
app/views/shared/_filter.html.haml
features/steps/dashboard/dashboard_issues.rb
features/steps/dashboard/dashboard_merge_requests.rb

index cbc8c33..d93eac4 100644 (file)
@@ -14,17 +14,11 @@ module DashboardHelper
   end
 
   def entities_per_project(project, entity)
-    items = project.items_for(entity)
-
-    items = case params[:status]
-            when 'closed'
-              items.closed
-            when 'all'
-              items
-            else
-              items.opened
-            end
-
-    items.cared(current_user).count
+    case entity.to_sym
+    when :issue then @issues.where(project_id: project.id)
+    when :merge_request then @merge_requests.where(target_project_id: project.id)
+    else
+      []
+    end.count
   end
 end
index d48a8d6..13bda30 100644 (file)
@@ -6,7 +6,7 @@
           Assigned to me
       %li{class: ("active" if params[:scope] == 'authored')}
         = link_to filter_path(entity, scope: 'authored') do
-          Authored by me
+          Created by me
       %li{class: ("active" if params[:scope] == 'all')}
         = link_to filter_path(entity, scope: 'all') do
           All
index 47d83f7..9d486bd 100644 (file)
@@ -34,7 +34,7 @@ class DashboardIssues < Spinach::FeatureSteps
 
   step 'I click "Authored by me" link' do
     within ".scope-filter" do
-      click_link 'Authored by me'
+      click_link 'Created by me'
     end
   end
 
index 3c35462..f6fe474 100644 (file)
@@ -34,7 +34,7 @@ class DashboardMergeRequests < Spinach::FeatureSteps
 
   step 'I click "Authored by me" link' do
     within ".scope-filter" do
-      click_link 'Authored by me'
+      click_link 'Created by me'
     end
   end