diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-23 15:30:24 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-23 15:30:24 +0200 |
commit | 31b15e3dce2817d8cd6d70cda97c6b9dbf5c7f8a (patch) | |
tree | 704788a66dc2ba75baba94c28a7f012aa70f32f9 /lib/ci | |
parent | 0731a7af319e4c19e98a43b7355fa26f5e8bd6f5 (diff) | |
download | gitlab-ce-31b15e3dce2817d8cd6d70cda97c6b9dbf5c7f8a.tar.gz |
Simplify CI projects query
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/project_list_builder.rb | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/lib/ci/project_list_builder.rb b/lib/ci/project_list_builder.rb deleted file mode 100644 index da26f9a9f47..00000000000 --- a/lib/ci/project_list_builder.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Ci - class ProjectListBuilder - def execute(current_user, search = nil) - projects = current_user.authorized_projects - projects = projects.search(search) if search - - projects. - joins("LEFT JOIN ci_projects ON projects.id = ci_projects.gitlab_id - LEFT JOIN #{last_commit_subquery} AS last_commit ON #{Ci::Project.table_name}.id = last_commit.project_id"). - reorder("ci_projects.id is NULL ASC, - CASE WHEN last_commit.committed_at IS NULL THEN 1 ELSE 0 END, - last_commit.committed_at DESC") - end - - private - - def last_commit_subquery - "(SELECT project_id, MAX(committed_at) committed_at FROM #{Ci::Commit.table_name} GROUP BY project_id)" - end - end -end |