add: projects filter choosed

This commit is contained in:
vilet.yy 2021-06-04 18:35:35 +08:00
parent 496867cac7
commit 2ea9fcd4d7
1 changed files with 6 additions and 1 deletions

View File

@ -57,6 +57,11 @@ class Projects::ListMyQuery < ApplicationQuery
sort = params[:sort_by] || "updated_on"
sort_direction = params[:sort_direction] || "desc"
scope.order("projects.#{sort} #{sort_direction}")
if params[:choosed].present? && params[:choosed].is_a?(Array)
scope.order("FIELD(id, #{params[:choosed].reverse.join(",")}) desc")
else
scope.order("projects.#{sort} #{sort_direction}")
end
end
end