Order only for latest_successful_for
Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8286#note_20461082
This commit is contained in:
parent
645412b57f
commit
655289dd33
1 changed files with 3 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue