class Maintenance::Nursing::LogTimeCleanupJob
  include Sidekiq::Worker

  def perform(school_id)
    school = School.find(school_id)
    Time.zone = school.time_zone
    logs = school.nursing_logs.where.not(datetime: nil)
    logs.each do |log|
      next if log.datetime.nil?

      time = log.datetime.utc.to_s.tr('UTC', '').strip
      log.entry_date = time
      log.save(validate: false)
    end
  end
end
