Class: Validators::InProgressValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/models/validators/in_progress_validator.rb

Overview

Displays a warning if the requests on the plate have already been completed

Instance Method Summary collapse

Instance Method Details

#validate(presenter) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'app/models/validators/in_progress_validator.rb', line 6

def validate(presenter)
  return true unless presenter.labware.any_complete_requests?

  presenter.errors.add(
    :libraries,
    'on this plate have already been completed. ' \
      'Any further work conducted from this plate may run into issues at the end of the pipeline.'
  )
end