主页不要标签

ecloud_sso
daiao 5 years ago
parent 52f6c8f8ae
commit 36e918ea35

@ -86,11 +86,11 @@ class ShixunsController < ApplicationController
@shixuns = @shixuns.includes(:tag_repertoires, :challenges).page(page).per(limit)
@tag_name_map = TagRepertoire.joins(:shixun_tag_repertoires)
.where(shixun_tag_repertoires: { shixun_id: @shixuns.map(&:id) })
.group('shixun_tag_repertoires.shixun_id')
.select('shixun_id, tag_repertoires.name')
.each_with_object({}) { |r, obj| obj[r.shixun_id] = r.name }
#@tag_name_map = TagRepertoire.joins(:shixun_tag_repertoires)
# .where(shixun_tag_repertoires: { shixun_id: @shixuns.map(&:id) })
# .group('shixun_tag_repertoires.shixun_id')
# .select('shixun_id, tag_repertoires.name')
# .each_with_object({}) { |r, obj| obj[r.shixun_id] = r.name }
end
def shixun_list

@ -16,7 +16,7 @@ json.array! shixuns do |shixun|
json.is_jupyter shixun.is_jupyter?
json.power (current_user.shixun_permission(shixun)) # 现在首页只显示已发布的实训
# REDO: 局部缓存
json.tag_name @tag_name_map&.fetch(shixun.id, nil) || shixun.tag_repertoires.first.try(:name)
json.tag_name nil # @tag_name_map&.fetch(shixun.id, nil) || shixun.tag_repertoires.first.try(:name)
json.myshixuns_count shixun.myshixuns_count
json.stu_num shixun.myshixuns_count
json.score_info shixun.averge_star

Loading…
Cancel
Save