Class: CollectionObject::BiologicalCollectionObject

Inherits:
CollectionObject
  • Object
show all
Defined in:
app/models/collection_object/biological_collection_object.rb

Direct Known Subclasses

Lot, RangedLot, Specimen

Instance Attribute Summary

Attributes inherited from CollectionObject

#buffered_collecting_event, #buffered_determinations, #buffered_other_labels

Instance Method Summary collapse

Methods inherited from CollectionObject

#check_that_both_of_category_and_total_are_not_present

Methods included from Housekeeping

#has_polymorphic_relationship?

Instance Method Details

#current_determinationObject



9
10
11
# File 'app/models/collection_object/biological_collection_object.rb', line 9

def current_determination
  taxon_determinations.first
end

#reorder_determinations_by(attribute = :date) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/collection_object/biological_collection_object.rb', line 13

def reorder_determinations_by(attribute = :date)
  determinations = []
  if attribute == :date
    determinations = taxon_determinations.sort{|a, b| a.sort_date <=> b.sort_date }
  else
    determinations = taxon_determinations.order(attribute)
  end

  determinations.each_with_index do |td, i|
    td.update(position:  i)
  end
end