dev_jupyter
daiao 5 years ago
parent c0dbac511e
commit 4f5ff41d09

@ -50,11 +50,12 @@ class ShixunSearchService < ApplicationService
private
def search_options
model_options = {
includes: [ :shixun_info, :challenges, :subjects, user: { user_extension: :school } ]
}
model_options.merge!(where: { id: @shixuns.pluck(:id) })
model_options.merge!(order: sort_str)
model_options.merge!(order: {sort_str => order_str})
model_options.merge!(default_options)
model_options
end
@ -64,10 +65,6 @@ class ShixunSearchService < ApplicationService
end
def sort_str
if params[:sort] == "myshixuns_count"
"is_wechat_support=1 desc, myshixuns_count #{order_str}"
else
"myshixuns_count #{order_str}"
end
params[:sort] || "myshixuns_count"
end
end
Loading…
Cancel
Save