From 02df9fbe0f0a142307cce38aa37ed90b81d9fd98 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Thu, 23 Apr 2020 14:28:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=A6=96=E9=A1=B5=E7=9A=84?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/queries/projects/list_query.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/queries/projects/list_query.rb b/app/queries/projects/list_query.rb index aa4d679fe..c09274169 100644 --- a/app/queries/projects/list_query.rb +++ b/app/queries/projects/list_query.rb @@ -22,10 +22,11 @@ class Projects::ListQuery < ApplicationQuery .with_project_category(params[:category_id]) .with_project_language(params[:language_id]) scope_ids = scope.no_anomory_projects.distinct.pluck(:id) - scope = projects.where(id: scope_ids) + # scope = projects.where(id: scope_ids) sort = params[:sort_by] || "updated_on" sort_direction = params[:sort_direction] || "desc" - custom_sort(scope, "projects.#{sort}", sort_direction) + projects.where(id: scope_ids).reorder("projects.#{sort} #{sort_direction}") + # custom_sort(scope, "projects.#{sort}", sort_direction) end end