Class: Identifier::Local::TripCode

Inherits:
Identifier::Local show all
Includes:
Shared::DwcOccurrenceHooks
Defined in:
app/models/identifier/local/trip_code.rb

Overview

!! DEPRECATED

The Local Identifier that is used by collectors to uniquely identify collecting events.

Constant Summary

Constants included from Shared::DualAnnotator

Shared::DualAnnotator::ALWAYS_COMMUNITY

Instance Attribute Summary

Attributes inherited from Identifier

#cached, #cached_numeric_identifier, #identifier, #identifier_object_id, #namespace_id, #project_id, #type

Instance Method Summary collapse

Methods inherited from Identifier::Local

#build_cached, build_cached_prefix, #increment_identifier, #is_local?, #is_virtual?, update_cached, #with_namespaced_identifier

Methods inherited from Identifier

#build_cached, #build_cached_numeric_identifier, #is_global?, #is_local?, prototype_identifier, #set_cached, #type_name

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::Labels

#labeled?

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods included from Shared::PolymorphicAnnotator

#annotated_object_is_persisted?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Method Details

#deprecatedObject (private)

Always prevent use of this class



24
25
26
# File 'app/models/identifier/local/trip_code.rb', line 24

def deprecated
  errors.add(:identifier_object_type, 'TripCode is deprecated for FieldNumber, please use FieldNumber identifiers') 
end

#dwc_occurrencesObject



12
13
14
15
16
17
18
19
# File 'app/models/identifier/local/trip_code.rb', line 12

def dwc_occurrences
  DwcOccurrence
    .joins("JOIN collection_objects co on dwc_occurrence_object_id = co.id AND dwc_occurrence_object_type = 'CollectionObject'")
    .joins('JOIN collecting_events ce on ce.id = co.collecting_event_id')
    .joins("JOIN identifiers i on i.identifier_object_id = ce.id AND i.identifier_object_type = 'CollectingEvent'")
    .where(i: {id:})
    .distinct
end