Class: Observation::Sample
- Inherits:
-
Observation
- Object
- ActiveRecord::Base
- ApplicationRecord
- Observation
- Observation::Sample
- Defined in:
- app/models/observation/sample.rb
Overview
See Descriptor::Sample
Instance Attribute Summary
Attributes inherited from Observation
Instance Method Summary collapse
- #median_between_min_max ⇒ Object protected
- #valid_min_max_boundary ⇒ Object protected
- #valid_sample_mean ⇒ Object protected
Methods inherited from Observation
by_descriptors_and_rows, #continuous?, #convert_observation_object_global_id, copy, destroy_row, human_name, in_observation_matrix, object_scope, #observation_object, #otu_or_collection_object_set, #presence_absence?, #qualitative?, #set_observation_object_id, #set_type_from_descriptor, #type_matches_descriptor
Methods included from Shared::IsData
#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar
Methods included from Shared::Confidences
Methods included from Shared::Tags
#reject_tags, #tag_with, #tagged?, #tagged_with?
Methods included from Shared::Notes
#concatenated_notes_string, #reject_notes
Methods included from Shared::Depictions
#has_depictions?, #image_array=, #reject_depictions, #reject_images
Methods included from Shared::Identifiers
#identified?, #next_by_identifier, #previous_by_identifier, #reject_identifiers
Methods included from Shared::DataAttributes
#import_attributes, #internal_attributes, #keyword_value_hash, #reject_data_attributes
Methods included from Shared::Citations
#cited?, #mark_citations_for_destruction, #nomenclature_date, #origin_citation_source_id, #reject_citations, #requires_citation?, #sources_by_topic_id
Methods included from Housekeeping
#has_polymorphic_relationship?
Methods inherited from ApplicationRecord
Instance Method Details
#median_between_min_max ⇒ Object (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 |
#valid_min_max_boundary ⇒ Object (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 |
#valid_sample_mean ⇒ Object (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 |