app/lib/insight_students_with_high_absences.rb
# Returns JSON for the product about the student, along
# with the count of absences.
Returns JSON for the product about the student, along
with the count of absences.
Returns JSON for the product about the student along with the count of absences .
def sorted_students_json(pairs)
    sorted_pairs = pairs.sort_by do |pair|
      [-1 * pair[:count], pair[:student].last_name]
    end
    sorted_pairs.map do |pair|
      student = pair[:student]
      {
        count: pair[:count],
        student: student.as_json({
          :only => [:id, :email, :first_name, :last_name, :grade, :house]
        })
      }
    end
  end
def sorted_students_json ( pairs ) sorted_pairs = pairs . sort_by do | pair | [ - 1 * pair [ :count ] , pair [ :student ] . last_name ] end sorted_pairs . map do | pair | student = pair [ :student ] { count : pair [ :count ] , student : student . as_json ( { :only => [ :id , :email , :first_name , :last_name , :grade , :house ] } ) } end end
Returns JSON for the product about the student, along
with the count of absences.
Returns JSON for the product about the student along with the count of absences .
pairs
<not_specific>