From 815de0419a051e3dc5f812a36970623bb2528186 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 18 Jan 2020 10:30:43 +0800 Subject: [PATCH] 1 --- app/controllers/shixun_lists_controller.rb | 2 +- app/views/shixun_lists/index.json.jbuilder | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/shixun_lists_controller.rb b/app/controllers/shixun_lists_controller.rb index 268548df9..ece1d0be5 100644 --- a/app/controllers/shixun_lists_controller.rb +++ b/app/controllers/shixun_lists_controller.rb @@ -1,7 +1,7 @@ class ShixunListsController < ApplicationController def index @results = ShixunSearchService.call(search_params, current_laboratory) - Rails.logger.info("########results: #{@results}") + Rails.logger.info("########results: #{@results.includes(:subjects)}") end private diff --git a/app/views/shixun_lists/index.json.jbuilder b/app/views/shixun_lists/index.json.jbuilder index 9526b0173..094c2160b 100644 --- a/app/views/shixun_lists/index.json.jbuilder +++ b/app/views/shixun_lists/index.json.jbuilder @@ -21,8 +21,10 @@ json.shixun_list do json.pic url_to_avatar(obj) json.content highlights json.level level_to_s(obj.trainee) - json.subjects obj.subjects.visible.unhidden.uniq do |subject| - json.(subject, :id, :name) + if params[:sort] != "wechat_myshixuns_count" + json.subjects obj.subjects.visible.unhidden.uniq do |subject| + json.(subject, :id, :name) + end end end end \ No newline at end of file