class Maintenance::Nursing::ScreeningDateJob
  include Sidekiq::Worker

  def perform(school_id)
    school = School.find(school_id)

    school.nursing_screenings.each do |screening|
      student = screening.student
      next if student.date_of_birth.nil?

      date = student.date_of_birth + screening.Age.years
      screening.update(date: date)
    end
  end
end
