class Decidim::Budgets::Workflows::One

This Workflow allows users to vote in any budget, but only in one.

Public Instance Methods

discardable() click to toggle source

Public: Returns a list of budgets where the user can discard their order to vote in another.

Returns Array.

# File lib/decidim/budgets/workflows/one.rb, line 27
def discardable
  progress + voted
end
highlighted?(_resource) click to toggle source

No budget resource is highlighted for this workflow.

# File lib/decidim/budgets/workflows/one.rb, line 9
def highlighted?(_resource)
  false
end
vote_allowed?(resource, consider_progress: true) click to toggle source

Users can vote in any budget with this workflow, but only in one.

# File lib/decidim/budgets/workflows/one.rb, line 14
def vote_allowed?(resource, consider_progress: true)
  return false if voted.any?

  if consider_progress
    progress?(resource) || progress.none?
  else
    true
  end
end