redmine_graphs-trunk.patch

Peter Fern, 2009-10-05 05:26

Download (1.31 KB)

View differences:

app/controllers/graphs_controller.rb
104 104
        sql << " WHERE (%s)" % Project.allowed_to_condition(User.current, :view_issues)
105 105
        unless @project.nil?
106 106
            sql << " AND (project_id = #{@project.id}"
107
            sql << "    OR project_id IN (%s)" % @project.active_children.collect { |p| p.id }.join(',') unless @project.active_children.empty?
108
            sql << " )"
107
            sql << "    OR #{@project.project_condition(true)})"
109 108
        end 
110 109
        sql << " GROUP BY project_id"
111 110
        sql << " ORDER BY issue_count DESC"
......
267 266
    def confirm_issues_exist
268 267
        find_optional_project
269 268
        if !@project.nil?
270
            ids = [@project.id]
271
            ids += @project.active_children.collect(&:id)
272
            @issues = Issue.find(:first, :include => [:project], :conditions => ["#{Project.table_name}.id IN (?)", ids])
269
            @issues = Issue.find(:first, :include => [:project], :conditions => ["#{@project.project_condition(true)}"])
273 270
        else
274 271
            @issues = Issue.find(:first)
275 272
        end