Class: Tasks::AssertedDistributions::BasicEndemismController

Inherits:
ApplicationController
  • Object
show all
Includes:
TaskControllerConfiguration
Defined in:
app/controllers/tasks/asserted_distributions/basic_endemism_controller.rb

Instance Method Summary collapse

Methods included from TaskControllerConfiguration

#set_is_task_controller

Instance Method Details

#indexObject

GET



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/tasks/asserted_distributions/basic_endemism_controller.rb', line 5

def index
  @taxon_name = TaxonName.where(project_id: sessions_current_project_id).find(params[:taxon_name_id]) if params[:taxon_name_id].present?
  @taxon_name ||= sessions_current_project.root_taxon_name

  @shape =
   (GeographicArea.find(params[:geographic_area_id]) if
     params[:geographic_area_id].present?) ||
   (Gazetteer.find(params[:gazetteer_id]) if params[:gazetteer_id].present?) ||
    GeographicArea.first

  shape_type = @shape.kind_of?(GeographicArea) ? 'GeographicArea' : 'Gazetteer'
  @data = TaxonWorks::Analysis::AssertedDistribution::BasicEndemism
    .quick_endemism(@taxon_name, shape_type, @shape.id)
end