diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-05-14 15:49:09 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-05-14 15:49:09 +0300 |
commit | 7c3ca86370afd28306e5bcc6563ff03da0343536 (patch) | |
tree | 366873e8e1ddcb03911c4339c024fa99962c73ec /lib/api/projects.rb | |
parent | 5619c7b9687edbeb07f4f383bd0bd1a1d94a1b50 (diff) |
Add order option for projects API
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index e3fff79d68f..1f2251c9b9c 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -22,7 +22,12 @@ module API projects = projects.search(params[:search]) end - projects.reorder(project_order_by => project_sort) + if params[:ci_enabled_first].present? + projects.includes(:gitlab_ci_service). + reorder("services.active DESC, projects.#{project_order_by} #{project_sort}") + else + projects.reorder(project_order_by => project_sort) + end end def project_order_by |