Sha256: f52aad30f775bd083cc2acd9c4e47ebf43a4da8ad7b4c2d20ba94b875ab5de9b
Contents?: true
Size: 869 Bytes
Versions: 19
Compression:
Stored size: 869 Bytes
Contents
# frozen_string_literal: true module Decidim module Votings # A command to check if census data is given class CheckCensus < Rectify::Command def initialize(form) @form = form end # Executes the command. Broadcast this events: # - :ok when census is found # - :invalid when the form is not valid # - :not_found when census is not found # # Returns nothing. def call return broadcast(:invalid) unless form.valid? check_census end attr_reader :form, :session def check_census datum = Decidim::Votings::Census::Datum.find_by(dataset: form.current_participatory_space.dataset, hashed_check_data: form.hashed_check_data) if datum broadcast(:ok, datum) else broadcast(:not_found) end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems