From e558671e3c4db51b0ae85dc7f5526b462165b518 Mon Sep 17 00:00:00 2001 From: Sven Fuchs Date: Fri, 20 May 2016 15:16:42 +0200 Subject: [PATCH] make repos sortable on default_branch.current_build --- Gemfile.lock | 3 --- lib/travis/api/v3/queries/repositories.rb | 11 +++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1fd8a971..064187b1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -426,6 +426,3 @@ DEPENDENCIES travis-yaml! unicorn yard-sinatra! - -BUNDLED WITH - 1.11.2 diff --git a/lib/travis/api/v3/queries/repositories.rb b/lib/travis/api/v3/queries/repositories.rb index 7132fb00..a24ae4f4 100644 --- a/lib/travis/api/v3/queries/repositories.rb +++ b/lib/travis/api/v3/queries/repositories.rb @@ -1,10 +1,17 @@ module Travis::API::V3 class Queries::Repositories < Query params :active, :private, :starred, prefix: :repository - sortable_by :id, :github_id, :owner_name, :name, active: sort_condition(:active), :'default_branch.last_build' => 'builds.started_at' + + # TODO this looks like a leftover from a mergeconflict, maybe? + # see lib/travis/api/v3/query.rb#58 + # + # sortable_by :id, :github_id, :owner_name, :name, active: sort_condition(:active), + # :'default_branch.last_build' => 'builds.started_at' + sortable_by :id, :github_id, :owner_name, :name, active: sort_condition(:active), :'default_branch.last_build' => 'builds.started_at', - :current_build => "current_build_id %{order} NULLS LAST" + :'default_branch.current_build' => 'builds.started_at', + :current_build => 'current_build_id %{order} NULLS LAST' def for_member(user, **options) all(user: user, **options).joins(:users).where(users: user_condition(user), invalidated_at: nil)