You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
case params[:source]
|
|
when 'subject'
|
|
disciplines = Discipline.where(subject: 1).includes(subject_sub_disciplines: :subject_tag_disciplines)
|
|
json.disciplines disciplines do |dis|
|
|
json.(dis, :id, :name)
|
|
json.sub_disciplines dis.subject_sub_disciplines do |sub|
|
|
json.(sub, :id, :name)
|
|
json.tag_disciplines sub.subject_tag_disciplines do |tag|
|
|
json.(tag, :id, :name)
|
|
end
|
|
end
|
|
end
|
|
when 'shixun'
|
|
disciplines = Discipline.where(shixun: 1).includes(shixun_sub_disciplines: :shixun_tag_disciplines)
|
|
json.disciplines disciplines do |dis|
|
|
json.(dis, :id, :name)
|
|
json.sub_disciplines dis.shixun_sub_disciplines do |sub|
|
|
json.(sub, :id, :name)
|
|
json.tag_disciplines sub.shixun_tag_disciplines do |tag|
|
|
json.(tag, :id, :name)
|
|
end
|
|
end
|
|
end
|
|
when 'question'
|
|
disciplines = Discipline.where(question: 1).includes(question_sub_disciplines: :question_tag_disciplines)
|
|
json.disciplines disciplines do |dis|
|
|
json.(dis, :id, :name)
|
|
json.sub_disciplines dis.question_sub_disciplines do |sub|
|
|
json.(sub, :id, :name)
|
|
json.tag_disciplines sub.question_tag_disciplines do |tag|
|
|
json.(tag, :id, :name)
|
|
end
|
|
end
|
|
end
|
|
end |