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