class Reporting::Nursing::MissingVaccinationJob < Reporting::Job
  def process
    students = @school.students
      .preload(:nursing_vaccine_records)
      .left_joins(:student_medical)
      .where(StudentMed: { Exempt: [nil, 0] })
      .where(id: @params['ids'])
      .ordered

    @tmp_file = Pdf::Nursing::MissingVaccinationService.call(@school, students)
    @filename = "nursing_missing_vaccinations_#{timestamp}.pdf"
    save_to_user
    send_report
  end
end
