diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-14 14:07:41 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-14 17:28:38 +0200 |
commit | 09255eecd0812d35b09613a1cf2402d3108fcc49 (patch) | |
tree | 1e04881ed6a65819ed8d5c690f463941832f355c /app/models/ci | |
parent | a957eca6f364b7587175a6ffa647fc9df80abed9 (diff) | |
download | gitlab-ce-09255eecd0812d35b09613a1cf2402d3108fcc49.tar.gz |
Remove ordering from :ci_commits relation
Diffstat (limited to 'app/models/ci')
-rw-r--r-- | app/models/ci/commit.rb | 2 | ||||
-rw-r--r-- | app/models/ci/project.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb index 68864edfbbf..cd45366b34e 100644 --- a/app/models/ci/commit.rb +++ b/app/models/ci/commit.rb @@ -24,6 +24,8 @@ module Ci has_many :builds, class_name: 'Ci::Build' has_many :trigger_requests, dependent: :destroy, class_name: 'Ci::TriggerRequest' + scope :ordered, -> { order('CASE WHEN ci_commits.committed_at IS NULL THEN 0 ELSE 1 END', :committed_at, :id) } + validates_presence_of :sha validate :valid_commit_sha diff --git a/app/models/ci/project.rb b/app/models/ci/project.rb index 88ba933a434..afd697f03f1 100644 --- a/app/models/ci/project.rb +++ b/app/models/ci/project.rb @@ -205,7 +205,7 @@ module Ci end def commits - gl_project.ci_commits + gl_project.ci_commits.ordered end def builds |