diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index 54c01ddf238..816012762ce 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -8,8 +8,7 @@ class Projects::BuildsController < Projects::ApplicationController def index @scope = params[:scope] - @all_builds = project.ci_builds.order('created_at DESC').page(params[:page]).per(30) - + @all_builds = project.ci_builds @builds = case @scope when 'all' @@ -19,6 +18,7 @@ class Projects::BuildsController < Projects::ApplicationController else @all_builds.running_or_pending end + @builds = @builds.order('created_at DESC').page(params[:page]).per(30) end def cancel_all diff --git a/app/views/projects/builds/index.html.haml b/app/views/projects/builds/index.html.haml index b04784025f1..4d8ca16d98a 100644 --- a/app/views/projects/builds/index.html.haml +++ b/app/views/projects/builds/index.html.haml @@ -12,17 +12,17 @@ %li{class: ('active' if @scope.nil?)} = link_to project_builds_path(@project) do Running - %span.badge.js-running-count= @all_builds.running_or_pending.size + %span.badge.js-running-count= @all_builds.running_or_pending.count(:id) %li{class: ('active' if @scope == 'finished')} = link_to project_builds_path(@project, scope: :finished) do Finished - %span.badge.js-running-count= @all_builds.finished.size + %span.badge.js-running-count= @all_builds.finished.count(:id) %li{class: ('active' if @scope == 'all')} = link_to project_builds_path(@project, scope: :all) do All - %span.badge.js-totalbuilds-count= @all_builds.size + %span.badge.js-totalbuilds-count= @all_builds.count(:id) .gray-content-block List of #{@scope || 'running'} builds from this project