Files
grecia/app/components/budgets/map_component.rb
Javi Martín fb0caa3eda Remove obsolete check for the budget presence
This check isn't necessary since commit 7e3dd47d5, since now we check
that the budget is present before creating the components which call
this method.
2023-05-31 16:56:14 +02:00

25 lines
531 B
Ruby

class Budgets::MapComponent < ApplicationComponent
delegate :render_map, to: :helpers
attr_reader :budget
def initialize(budget)
@budget = budget
end
def render?
feature?(:map) && !budget.informing?
end
private
def coordinates
if budget.publishing_prices_or_later? && budget.investments.selected.any?
investments = budget.investments.selected
else
investments = budget.investments
end
MapLocation.where(investment_id: investments).map(&:json_data)
end
end