summaryrefslogtreecommitdiff
path: root/app/models/ci/project.rb
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <mail@zjvandeweg.nl>2015-11-11 13:07:02 +0100
committerZeger-Jan van de Weg <mail@zjvandeweg.nl>2015-11-11 13:07:02 +0100
commit7e4a7d9ecc02db06c568a0de47e096edbdc1224b (patch)
tree701af1b1789f17950a22a19df4cf8f69d3beb173 /app/models/ci/project.rb
parent3f08e4b186bd02b37f34ccf1bc641a95f9d865ce (diff)
parentdfa09789061bbd3891c17ebbcc23f7bd6b95336c (diff)
downloadgitlab-ce-7e4a7d9ecc02db06c568a0de47e096edbdc1224b.tar.gz
Merge branch 'master' into copying-file-seen-as-licence
Diffstat (limited to 'app/models/ci/project.rb')
-rw-r--r--app/models/ci/project.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/ci/project.rb b/app/models/ci/project.rb
index 88ba933a434..4e806ca1a68 100644
--- a/app/models/ci/project.rb
+++ b/app/models/ci/project.rb
@@ -99,6 +99,7 @@ module Ci
def ordered_by_last_commit_date
last_commit_subquery = "(SELECT gl_project_id, MAX(committed_at) committed_at FROM #{Ci::Commit.table_name} GROUP BY gl_project_id)"
joins("LEFT JOIN #{last_commit_subquery} AS last_commit ON #{Ci::Project.table_name}.gitlab_id = last_commit.gl_project_id").
+ joins(:gl_project).
order("CASE WHEN last_commit.committed_at IS NULL THEN 1 ELSE 0 END, last_commit.committed_at DESC")
end
end
@@ -115,12 +116,12 @@ module Ci
web_url
end
- def any_runners?
- if runners.active.any?
+ def any_runners?(&block)
+ if runners.active.any?(&block)
return true
end
- shared_runners_enabled && Ci::Runner.shared.active.any?
+ shared_runners_enabled && Ci::Runner.shared.active.any?(&block)
end
def set_default_values
@@ -205,7 +206,7 @@ module Ci
end
def commits
- gl_project.ci_commits
+ gl_project.ci_commits.ordered
end
def builds