Class: Observation::Sample

Inherits:
Observation show all
Defined in:
app/models/observation/sample.rb

Overview

See Descriptor::Sample

Instance Attribute Summary

Attributes inherited from Observation

#observation_object_global_id

Instance Method Summary (collapse)

Methods inherited from Observation

#convert_observation_object_global_id, copy, human_name, object_scope, #observation_object, #otu_or_collection_object_set, #set_observation_object_id

Methods included from Housekeeping

#has_polymorphic_relationship?

Instance Method Details

- (Object) median_between_min_max (protected)



19
20
21
22
23
# File 'app/models/observation/sample.rb', line 19

def median_between_min_max
  if sample_min.present? && sample_max.present? && sample_median.present?
    errors.add(:sample_median, 'is not between min and max)') if !(sample_median <= sample_max) || !(sample_median >= sample_min)
  end
end

- (Object) valid_min_max_boundary (protected)



14
15
16
17
# File 'app/models/observation/sample.rb', line 14

def valid_min_max_boundary
  errors.add(:sample_min, 'minimum is greater than maximum' ) if sample_min && sample_max && ( sample_min > sample_max )
  errors.add(:sample_max, 'maximum is less than minimum' ) if sample_min && sample_max && (sample_max < sample_min)
end

- (Object) valid_sample_mean (protected)



25
26
27
28
29
# File 'app/models/observation/sample.rb', line 25

def valid_sample_mean
  if sample_min.present? && sample_max.present? && sample_mean.present?
    errors.add(:sample_mean, 'is not between min and max)') if !(sample_mean <= sample_max) || !(sample_mean >= sample_min)
  end
end