if @bank.container_type == "Exercise"
  json.exercise do
    json.extract! @bank, :id, :name, :description, :is_public
  end
  json.authorize @bank.user_id == current_user.id || current_user.admin?

  json.partial! "exercises/exercise_scores"

  json.exercise_questions do
    json.array! @exercise_questions do |q|
      json.partial! "exercise_bank_questions/exercise_bank_questions",
                    question: q,
                    choices:q.exercise_bank_choices,
                    shixun_challenges: q.exercise_bank_shixun_challenges,
                    ques_position:nil,
                    edit_type:nil
    end
  end

else
  json.poll do
    json.extract! @bank, :id, :name, :description, :is_public
  end
  json.authorize @bank.user_id == current_user.id || current_user.admin?

  json.question_types do
    json.q_counts @poll_questions_count
    json.q_singles @poll_question_singles
    json.q_doubles @poll_question_doubles
    json.q_mains @poll_question_mains
  end

  json.questions @exercise_questions do | question|
    json.question do
      json.id question.id
      json.question_number question.question_number
      json.question_title question.question_title
      json.question_type question.question_type
      json.is_necessary question.is_necessary
      if question.question_type == 2
        json.max_choices question.max_choices
        json.min_choices question.min_choices
      end
      json.answers do
        json.array! question.exercise_bank_choices do | a|
          json.answer_id a.id
          json.answer_position a.choice_position
          json.answer_text a.choice_text.nil? ? "other_choices" : a.choice_text  ##
        end
      end
    end
  end
end