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