summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-12 13:08:18 -0500
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-12 13:08:18 -0500
commit0d43b9270677106f3aa37112da1dd0482ed40b55 (patch)
tree24f89bf7bd67dfa94941e5732e1235a229688081
parent86cedb082576ceca3522c33c10d367d765e02cf8 (diff)
downloadgitlab-ce-0d43b9270677106f3aa37112da1dd0482ed40b55.tar.gz
Fix CI tests
-rw-r--r--app/controllers/projects/pipelines_controller.rb8
-rw-r--r--app/models/project.rb2
-rw-r--r--app/services/ci/create_pipeline_service.rb2
-rw-r--r--app/views/projects/commit/_ci_stage.html.haml5
-rw-r--r--app/views/projects/pipelines/index.html.haml4
5 files changed, 12 insertions, 9 deletions
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index a261d03f4d0..bdb5722c55f 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -7,8 +7,10 @@ class Projects::PipelinesController < Projects::ApplicationController
def index
@scope = params[:scope]
- @all_pipelines = project.ci_commits
- @pipelines = PipelinesFinder.new(project).execute(@all_pipelines, @scope)
+ all_pipelines = project.ci_commits
+ @pipelines_count = all_pipelines.count
+ @running_or_pending_count = all_pipelines.running_or_pending.count
+ @pipelines = PipelinesFinder.new(project).execute(all_pipelines, @scope)
@pipelines = @pipelines.order(id: :desc).page(params[:page]).per(30)
end
@@ -22,7 +24,7 @@ class Projects::PipelinesController < Projects::ApplicationController
rescue ArgumentError => e
@error = e.message
render 'new'
- rescue => e
+ rescue
@error = 'Undefined error'
render 'new'
end
diff --git a/app/models/project.rb b/app/models/project.rb
index dfd1e54ecf7..82489235a3f 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -354,7 +354,7 @@ class Project < ActiveRecord::Base
join_body = "INNER JOIN (
SELECT project_id, COUNT(*) AS amount
FROM notes
- WHERE created_at >= #{sanitize(since)}
+ WHERE created_at >= #{sanitize(since)}project.ci_commits
GROUP BY project_id
) join_note_counts ON projects.id = join_note_counts.project_id"
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index 40414b49864..223514968fc 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -39,4 +39,4 @@ module Ci
@pipeline ||= project.ci_commits.new(sha: commit.id, ref: params[:ref], before_sha: Gitlab::Git::BLANK_SHA)
end
end
-end \ No newline at end of file
+end
diff --git a/app/views/projects/commit/_ci_stage.html.haml b/app/views/projects/commit/_ci_stage.html.haml
index f9f2757dc34..bdadf2944c4 100644
--- a/app/views/projects/commit/_ci_stage.html.haml
+++ b/app/views/projects/commit/_ci_stage.html.haml
@@ -6,8 +6,9 @@
- status = latest.status
%span{class: "ci-status-link ci-status-icon-#{status}"}
= ci_icon_for_status(status)
- &nbsp;
- = stage.titleize.pluralize
+ - if stage
+ &nbsp;
+ = stage.titleize.pluralize
= render latest.ordered, coverage: @project.build_coverage_enabled?, tage: false, ref: false, allow_retry: true
= render retried.ordered, coverage: @project.build_coverage_enabled?, stage: false, ref: false, retried: true
%tr
diff --git a/app/views/projects/pipelines/index.html.haml b/app/views/projects/pipelines/index.html.haml
index d247ea445ea..574941ed5f2 100644
--- a/app/views/projects/pipelines/index.html.haml
+++ b/app/views/projects/pipelines/index.html.haml
@@ -7,13 +7,13 @@
= link_to project_pipelines_path(@project) do
All
%span.badge.js-totalbuilds-count
- = number_with_delimiter(@all_pipelines.count)
+ = number_with_delimiter(@pipelines_count)
%li{class: ('active' if @scope == 'running')}
= link_to project_pipelines_path(@project, scope: :running) do
Running
%span.badge.js-running-count
- = number_with_delimiter(@all_pipelines.running_or_pending.count)
+ = number_with_delimiter(@running_or_pending_count)
%li{class: ('active' if @scope == 'branches')}
= link_to project_pipelines_path(@project, scope: :branches) do