parent
2b6e101547
commit
c1a916484e
@ -1,15 +1,17 @@
|
|||||||
json.shixun_list @shixuns do |shixun|
|
json.shixuns_count @total_count
|
||||||
json.shixun_id shixun.id
|
|
||||||
json.identifier shixun.identifier
|
json.shixun_list do
|
||||||
json.shixun_name shixun.name
|
json.array! @shixuns.with_highlights(multiple: true) do |obj, highlights|
|
||||||
json.description shixun.description
|
puts obj
|
||||||
json.myshixuns_count shixun.myshixuns_count
|
json.merge! obj.to_searchable_json
|
||||||
json.school shixun.user&.school_name
|
json.challenge_names obj.challenges.pluck(:subject)
|
||||||
json.creator shixun.user&.full_name
|
|
||||||
json.level level_to_s(shixun.trainee)
|
|
||||||
json.subjects shixun.subjects do |subject|
|
|
||||||
json.(subject, :id, :name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
json.shixuns_count @total_count
|
json.title highlights.delete(:name)&.join('...') || obj.searchable_title
|
||||||
|
# json.description highlights.values[0,5].each { |arr| arr.is_a?(Array) ? arr.join('...') : arr }.join('<br/>')
|
||||||
|
json.content highlights
|
||||||
|
json.level level_to_s(obj.trainee)
|
||||||
|
json.subjects obj.subjects do |subject|
|
||||||
|
json.(subject, :id, :name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue