diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-06 11:59:55 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-06 11:59:55 +0200 |
commit | a266752821116e4736c493ad865e5ba6e1821c0d (patch) | |
tree | 49b584cd71f7d841fe0abfbe91cfd787edb8891c | |
parent | fc795d6ee2bdc1229f82c535222752364b5c9e44 (diff) | |
download | gitlab-ce-a266752821116e4736c493ad865e5ba6e1821c0d.tar.gz |
Latest builds always include builds with unique name and unique ref
-rw-r--r-- | app/models/ci/build.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index f35224916ed..3c92710968c 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -47,7 +47,7 @@ module Ci scope :failed, ->() { where(status: "failed") } scope :unstarted, ->() { where(runner_id: nil) } scope :running_or_pending, ->() { where(status:[:running, :pending]) } - scope :latest, ->() { where(id: unscope(:select).select('max(id)').group(:name)).order(stage_idx: :asc) } + scope :latest, ->() { where(id: unscope(:select).select('max(id)').group(:name, :ref)).order(stage_idx: :asc) } scope :ignore_failures, ->() { where(allow_failure: false) } scope :for_ref, ->(ref) { where(ref: ref) } scope :similar, ->(build) { where(ref: build.ref, tag: build.tag, trigger_request_id: build.trigger_request_id) } |