summaryrefslogtreecommitdiff
path: root/app/models/ci/pipeline.rb
diff options
context:
space:
mode:
authorRegis <boudinot.regis@yahoo.com>2017-01-02 16:24:37 -0700
committerRegis <boudinot.regis@yahoo.com>2017-01-02 16:24:37 -0700
commit0a074f2e091d8b2f1bce49e50ecf69b667c62dc2 (patch)
tree314027556f06514278a4f83f35813c00b2d5418f /app/models/ci/pipeline.rb
parent588219352c99213d099aff72f32d6ad9ec4830d4 (diff)
parentde25604fbca2f7005754d821d571bbcb1cc510ac (diff)
downloadgitlab-ce-0a074f2e091d8b2f1bce49e50ecf69b667c62dc2.tar.gz
fix pipelines/index.html.haml merge conflict
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r--app/models/ci/pipeline.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 1814469f6ce..2a97e8bae4a 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -93,11 +93,8 @@ module Ci
.select("max(#{quoted_table_name}.id)")
.group(:ref, :sha)
- if ref
- where(id: max_id, ref: ref)
- else
- where(id: max_id)
- end
+ relation = ref ? where(ref: ref) : self
+ relation.where(id: max_id)
end
def self.latest_status(ref = nil)
@@ -105,7 +102,7 @@ module Ci
end
def self.latest_successful_for(ref)
- success.latest(ref).first
+ success.latest(ref).order(id: :desc).first
end
def self.truncate_sha(sha)