- aggregated_responses = question.aggregated_responses_for_school(@school)
- return if aggregated_responses.nil?
- school_question = Legacy::SchoolQuestion.for(@school, question).first
- valid_responses = school_question.nil? ? true : school_question.response_rate > 0.3 # || (aggregated_responses.count.to_f / @school.available_responders_for(question).to_f)) >= 0.3

.col-12.col-md-6.py-3
  .question.p-2{id: "question-#{question.id}"}
    %p.question-text.pt-3.px-2
      = question.normalized_text

      - if valid_responses
        .row.pt-2
          .col-4.indicator-container.centered
            = render 'legacy/school_categories/indicator', info: aggregated_responses, small: true

          .col-8
            %p
              %b Total Responses:
              = aggregated_responses.count
            %p
              %b Most Popular:
              = truncate(aggregated_responses.most_popular_answer, length: 27)
            %p
              %b Source:
              = question.source.titleize
      - else
        .row.pt-2
          .col-12.centered
            .px-2
              %br
              %h5 Insufficient Responses
              %p No data is displayed for this question because of insufficient responses.
              - if params.include?(:show_possible)
                %p= "Responded: #{aggregated_responses.count}, Possible: #{@school.available_responders_for(question)}"
              %p= "Source: #{question.for_teachers? ? "Teachers" : "Students"}"
              %br


    - if valid_responses
      .clearfix

      .show-hide.px-2
        %p
          %a{"aria-controls" => "histogram#{question.id}", "aria-expanded" => "false", "data-toggle" => "collapse", :href => "#histogram#{question.id}"}
            Histogram
          &nbsp;&nbsp;|&nbsp;&nbsp;
          %a{"aria-controls" => "raw-data#{question.id}", "aria-expanded" => "false", "data-toggle" => "collapse", :href => "#raw-data#{question.id}"}
            Raw Data

        .collapse{id: "histogram#{question.id}"}
          = render 'legacy/shared/histogram', data: aggregated_responses

        %p.collapse{id: "raw-data#{question.id}"}
          = aggregated_responses.responses.map(&:answer_index_with_reverse).join(', ')

    -# - if school_question.present?
    -#   .clearfix
    -#     %p= "Attempts: #{school_question.attempt_count}, Responses: #{school_question.response_count}, Response Rate: #{number_to_percentage(school_question.response_rate * 100, precision: 0)}, Total: #{school_question.response_total}"
