Project

General

Profile

Defect #10084 » fixed-10084.patch

Yuichi HARADA, 2020-10-29 05:57

View differences:

app/controllers/projects_controller.rb
172 172
    @principals_by_role = @project.principals_by_role
173 173
    @subprojects = @project.children.visible.to_a
174 174
    @news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").to_a
175
    @trackers = @project.rolled_up_trackers.visible
175
    with_subprojects = Setting.display_subprojects_issues?
176
    @trackers = @project.rolled_up_trackers(with_subprojects).visible
176 177

  
177
    cond = @project.project_condition(Setting.display_subprojects_issues?)
178
    cond = @project.project_condition(with_subprojects)
178 179

  
179 180
    @open_issues_by_tracker = Issue.visible.open.where(cond).group(:tracker).count
180 181
    @total_issues_by_tracker = Issue.visible.where(cond).group(:tracker).count
test/functional/projects_controller_test.rb
750 750
    assert_select 'table.issue-report td.total a', :text => %r{\A[1-9]\d*\z}
751 751
  end
752 752

  
753
  def test_show_with_display_subprojects_issues_enabled_should_display_subproject_tracker_in_issue_tracking
754
    project = Project.find('ecookbook')
755
    tracker = project.trackers.find_by_name('Support request')
756
    project.trackers.delete(tracker)
757
    @request.session[:user_id] = 2
758

  
759
    with_settings :display_subprojects_issues => '1' do
760
      get(:show, :params => {:id => 'ecookbook'})
761
      assert_response :success
762
      assert_select 'table.issue-report td.name', :text => 'Support request', :count => 1
763
    end
764

  
765
    with_settings :display_subprojects_issues => '0' do
766
      get(:show, :params => {:id => 'ecookbook'})
767
      assert_response :success
768
      assert_select 'table.issue-report td.name', :text => 'Support request', :count => 0
769
    end
770
  end
771

  
753 772
  def test_show_should_spent_and_estimated_time
754 773
    @request.session[:user_id] = 1
755 774
    get(:show, :params => {:id => 'ecookbook'})
(1-1/2)