diff --git a/app/services/shixun_search_service.rb b/app/services/shixun_search_service.rb index c8db74325..21ad7fcf4 100644 --- a/app/services/shixun_search_service.rb +++ b/app/services/shixun_search_service.rb @@ -51,11 +51,17 @@ class ShixunSearchService < ApplicationService def search_options + order = + if sort_str == "wechat_myshixun_count" + {"is_wechat_support" => "desc", sort_str => order_str} + else + {sort_str => order_str} + end 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 => order_str}) + model_options.merge!(order: order) model_options.merge!(default_options) model_options end