Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/m_taxon_concept.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class MTaxonConcept < ApplicationRecord
class_name: 'MCmsListingChange'

has_many :cites_processes
has_many :distributions, foreign_key: :taxon_concept_id

scope :by_cites_eu_taxonomy, -> { where(taxonomy_is_cites_eu: true) }
scope :by_cms_taxonomy, -> { where(taxonomy_is_cites_eu: false) }
Expand Down
7 changes: 7 additions & 0 deletions app/serializers/checklist/distribution_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Checklist::DistributionSerializer < ActiveModel::Serializer
attributes :geo_entity_id, :tag_names

def tag_names
object.tags.map(&:name)
end
end
3 changes: 3 additions & 0 deletions app/serializers/checklist/taxon_concept_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class Checklist::TaxonConceptSerializer < ActiveModel::Serializer
has_many :current_cites_additions, serializer: Checklist::ListingChangeSerializer,
key: :current_additions

has_many :distributions, serializer: Checklist::DistributionSerializer,
key: :distributions

def id
if object.is_a? Checklist::HigherTaxaItem
object.id + 1000000 # unless ids differ, Ember will create a single object
Expand Down