class Reporting::Nursing::LogsJob < Reporting::Job
  def process
    @tmp_file = if student
      Pdf::Nursing::StudentLogService.call(student, @params)
    else
      Pdf::Nursing::LogsService.call(@school, @params)
    end
    @filename = "nursing_logs_#{timestamp}.pdf"
    save_to_user
    send_report
  end

  private
    def student
      @student ||= @school.students.find_by(id: @params['student_id'])
    end
end
