Project

General

Profile

Defect #10084 » 10084-v2.patch

Go MAEDA, 2020-12-08 02:58

View differences:

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

  
180
    cond = @project.project_condition(Setting.display_subprojects_issues?)
181
    cond = @project.project_condition(with_subprojects)
181 182

  
182 183
    @open_issues_by_tracker = Issue.visible.open.where(cond).group(:tracker).count
183 184
    @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_should_not_display_subprojects_trackers_when_subprojects_issues_is_not_displayed
754
    project = Project.find('ecookbook')
755
    tracker = project.trackers.find(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'})
(2-2/2)