diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 5d90c92af..a75e4120a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -95,14 +95,14 @@ class ProjectsController < ApplicationController @trackers = @project.rolled_up_trackers cond = @project.project_condition(Setting.display_subprojects_issues?) - Issue.visible_by(User.current) do - @open_issues_by_tracker = Issue.count(:group => :tracker, + + @open_issues_by_tracker = Issue.visible.count(:group => :tracker, :include => [:project, :status, :tracker], :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) - @total_issues_by_tracker = Issue.count(:group => :tracker, + @total_issues_by_tracker = Issue.visible.count(:group => :tracker, :include => [:project, :status, :tracker], :conditions => cond) - end + TimeEntry.visible_by(User.current) do @total_hours = TimeEntry.sum(:hours, :include => :project, diff --git a/app/models/issue.rb b/app/models/issue.rb index 84a3c8e3c..d333fe3cc 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -270,12 +270,6 @@ class Issue < ActiveRecord::Base @soonest_start ||= relations_to.collect{|relation| relation.successor_soonest_start}.compact.min end - def self.visible_by(usr) - with_scope(:find => { :conditions => Project.visible_by(usr) }) do - yield - end - end - def to_s "#{tracker} ##{id}: #{subject}" end