35374.patch

Felix Schäfer, 2021-06-08 15:51

Download (2.13 KB)

View differences:

app/controllers/projects_controller.rb
172 172
      return
173 173
    end
174 174

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

  
181
    cond = @project.project_condition(with_subprojects)
175
    respond_to do |format|
176
      format.html {
177
        @principals_by_role = @project.principals_by_role
178
        @subprojects = @project.children.visible.to_a
179
        @news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").to_a
180
        with_subprojects = Setting.display_subprojects_issues?
181
        @trackers = @project.rolled_up_trackers(with_subprojects).visible
182 182

  
183
    @open_issues_by_tracker = Issue.visible.open.where(cond).group(:tracker).count
184
    @total_issues_by_tracker = Issue.visible.where(cond).group(:tracker).count
183
        cond = @project.project_condition(with_subprojects)
185 184

  
186
    if User.current.allowed_to_view_all_time_entries?(@project)
187
      @total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f
188
      @total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f
189
    end
185
        @open_issues_by_tracker = Issue.visible.open.where(cond).group(:tracker).count
186
        @total_issues_by_tracker = Issue.visible.where(cond).group(:tracker).count
190 187

  
191
    @key = User.current.rss_key
188
        if User.current.allowed_to_view_all_time_entries?(@project)
189
          @total_hours = TimeEntry.visible.where(cond).sum(:hours).to_f
190
          @total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f
191
        end
192 192

  
193
    respond_to do |format|
194
      format.html
193
        @key = User.current.rss_key
194
      }
195 195
      format.api
196 196
    end
197 197
  end