Module: Shared::BiologicalExtensions

Extended by:
ActiveSupport::Concern
Included in:
CollectionObject, FieldOccurrence
Defined in:
app/models/concerns/shared/biological_extensions.rb

Overview

This is all code that properly belongs in CollectionObject::BiologicalCollectionObject, but because inheritance sucks sometimes we include it at the top level

Instance Method Summary collapse

Instance Method Details

#missing_determinationObject

see BiologicalCollectionObject



59
60
# File 'app/models/concerns/shared/biological_extensions.rb', line 59

def missing_determination
end

#name_at_rank_string(rank) ⇒ String

Ugh: TODO: deprecate! no utility gained here, and it’s HTML!!!

Parameters:

  • rank (String)

Returns:

  • (String)

    if a determination exists, and the Otu in the determination has a taxon name then return the taxon name at the rank supplied



69
70
71
# File 'app/models/concerns/shared/biological_extensions.rb', line 69

def name_at_rank_string(rank)
  current_taxon_name.try(:ancestor_at_rank, rank).try(:cached_html)
end

#reject_otus(attributed) ⇒ Object



78
79
80
81
82
# File 'app/models/concerns/shared/biological_extensions.rb', line 78

def reject_otus(attributed)
  a = attributed['taxon_name_id']
  b = attributed['name']
  a.blank? && b.blank?
end

#reject_taxon_determinations(attributed) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
# File 'app/models/concerns/shared/biological_extensions.rb', line 74

def reject_taxon_determinations(attributed)
  attributed['otu_id'].blank? && attributed[:otu]&.id.blank?
end

#requires_taxon_determination?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'app/models/concerns/shared/biological_extensions.rb', line 62

def requires_taxon_determination?
  false
end