summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/runner_jobs_finder.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/app/finders/runner_jobs_finder.rb b/app/finders/runner_jobs_finder.rb
index f1ee1d38255..ef90817416a 100644
--- a/app/finders/runner_jobs_finder.rb
+++ b/app/finders/runner_jobs_finder.rb
@@ -3,7 +3,7 @@
class RunnerJobsFinder
attr_reader :runner, :params
- ALLOWED_INDEXED_COLUMNS = %w[id created_at].freeze
+ ALLOWED_INDEXED_COLUMNS = %w[id].freeze
def initialize(runner, params = {})
@runner = runner
@@ -28,13 +28,10 @@ class RunnerJobsFinder
# rubocop: disable CodeReuse/ActiveRecord
def sort_items(items)
- order_by = if ALLOWED_INDEXED_COLUMNS.include?(params[:order_by])
- params[:order_by]
- else
- :id
- end
+ return items unless ALLOWED_INDEXED_COLUMNS.include?(params[:order_by])
- sort = if params[:sort] =~ /\A(ASC|DESC)\z/i
+ order_by = params[:order_by]
+ sort = if /\A(ASC|DESC)\z/i.match?(params[:sort])
params[:sort]
else
:desc