Sha256: 56465b7992b52cca9c6f7ee17591ac7d55e9fedf20adbb7a71ee624b2db65b61
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
# frozen_string_literal: true module Decidim module Lausanne module Budgets module Workflows # This Workflow allows users to vote in any budget, but only in one. class One < Base # No budget resource is highlighted for this workflow. def highlighted?(_resource) false end # Users can vote in any budget with this workflow, but only in one. def vote_allowed?(resource, consider_progress: true) return false if voted.any? if consider_progress progress?(resource) || progress.none? else true end end # Public: Returns a list of budgets where the user can discard their order to vote in another. # # Returns Array. def discardable progress + voted end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-lausanne-budgets-0.1.0 | lib/decidim/lausanne/budgets/workflows/one.rb |