app/models/taxon_concept.rb
# Public method, because we can do this from TaxonMedia:
# TODO - This should move to TaxonUserClassificationFilter, because it requires that information.
Public method, because we can do this from TaxonMedia:
TODO - This should move to TaxonUserClassificationFilter, because it requires that information.
Public method because we can do this from TaxonMedia : TODO - This should move to TaxonUserClassificationFilter because it requires that information .
def update_media_count(options = {})
    selected_hierarchy_entry = options[:entry]
    cache_key = "media_count_#{self.id}"
    cache_key += "_#{selected_hierarchy_entry.id}" if selected_hierarchy_entry && selected_hierarchy_entry.class == HierarchyEntry
    if options[:user] && options[:user].is_curator?
      cache_key += "_curator"
    end
    Rails.cache.delete(TaxonConcept.cached_name_for(cache_key)) if options[:with_count]
    Rails.cache.fetch(TaxonConcept.cached_name_for(cache_key), expires_in: 1.days) do
      if options[:with_count]
        options[:with_count]
      else
        best_images = self.data_objects_from_solr({
          per_page: 1,
          data_type_ids: DataType.image_type_ids + DataType.video_type_ids + DataType.sound_type_ids,
          vetted_types: options[:user].vetted_types,
          visibility_types: options[:user].visibility_types,
          ignore_translations: true,
          return_hierarchically_aggregated_objects: true
        }).total_entries
      end
    end
  end
def update_media_count ( options = { } ) selected_hierarchy_entry = options [ :entry ] cache_key = "media_count_#{self.id}" cache_key += "_#{selected_hierarchy_entry.id}" if selected_hierarchy_entry && selected_hierarchy_entry . class == HierarchyEntry if options [ :user ] && options [ :user ] . is_curator? cache_key += "_curator" end Rails . cache . delete ( TaxonConcept . cached_name_for ( cache_key ) ) if options [ :with_count ] Rails . cache . fetch ( TaxonConcept . cached_name_for ( cache_key ) , expires_in : 1 . days ) do if options [ :with_count ] options [ :with_count ] else best_images = self . data_objects_from_solr ( { per_page : 1 , data_type_ids : DataType . image_type_ids + DataType . video_type_ids + DataType . sound_type_ids , vetted_types : options [ :user ] . vetted_types , visibility_types : options [ :user ] . visibility_types , ignore_translations : true , return_hierarchically_aggregated_objects : true } ) . total_entries end end end
Public method, because we can do this from TaxonMedia:
TODO - This should move to TaxonUserClassificationFilter, because it requires that information.
Public method because we can do this from TaxonMedia : TODO - This should move to TaxonUserClassificationFilter because it requires that information .
options
<not_specific>