Class: Collector
Class Method Summary
collapse
-
.human_name ⇒ Object
Collectors should not trigger spatial updates def cached_triggers return { } # { CollectingEvent: [:set_cached_cached ] } # does not yet reference Collecotrs end.
Instance Method Summary
collapse
#set_project_if_possible
#has_polymorphic_relationship?
Class Method Details
.human_name ⇒ Object
Collectors should not trigger spatial updates
def cached_triggers
return { } # { CollectingEvent: [:set_cached_cached ] } # does not yet reference Collecotrs
end
33
34
35
|
# File 'app/models/collector.rb', line 33
def self.human_name
'Collector'
end
|
Instance Method Details
#do_not_set_cached ⇒ Object
24
25
26
|
# File 'app/models/collector.rb', line 24
def do_not_set_cached
true
end
|
#dwc_occurrences ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/models/collector.rb', line 6
def dwc_occurrences
co = 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 co.collecting_event_id = ce.id')
.joins("JOIN roles r on r.type = 'Collector' AND r.role_object_type = 'CollectingEvent' AND r.role_object_id = ce.id")
.where(r: {id:})
.distinct
fo = DwcOccurrence
.joins("JOIN field_occurrences fo on dwc_occurrence_object_id = fo.id AND dwc_occurrence_object_type = 'FieldOccurrence'")
.joins('JOIN collecting_events ce on fo.collecting_event_id = ce.id')
.joins("JOIN roles r on r.type = 'Collector' AND r.role_object_type = 'CollectingEvent' AND r.role_object_id = ce.id")
.where(r: {id:})
.distinct
::Queries.union(DwcOccurrence, [co, fo])
end
|
#year_active_year ⇒ Object
37
38
39
40
41
|
# File 'app/models/collector.rb', line 37
def year_active_year
[ role_object.end_date_year,
role_object.start_date_year
].compact.first
end
|