class Reporting::Nursing::EmergencyInfoJob < Reporting::Job
  def process
    students = @school.students
      .where(id: @params['ids'])
      .includes(family: :contact_families)
      .ordered
    create_tmp_file
    create_pdf
    students.each do |student|
      file = Pdf::Nursing::EmergencyInfoService.call(student)
      @pdf << CombinePDF.load(file.path)
    end
    save_pdf
    @filename = "nursing_emergency_information_#{timestamp}.pdf"
    save_to_user
    send_report
  end
end
