Sha256: 6c1cc05bd362ec7d0c482f73cf6d9e722206dcbd422b5b940e1fb184bf392f72
Contents?: true
Size: 1.07 KB
Versions: 12
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module Decidim module Votings module Admin # A command with all the business logic for a monitornig committee member to validate a polling station closure class MonitoringCommitteeValidatePollingStationClosure < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. # closure - A closure object. def initialize(form, closure) @form = form @closure = closure end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the form wasn't valid and we couldn't proceed. # # Returns nothing. def call return broadcast(:invalid) if form.invalid? closure.update!(validated_at: Time.current, monitoring_committee_notes: form.monitoring_committee_notes) broadcast(:ok) rescue ActiveRecord::RecordInvalid broadcast(:invalid) end attr_reader :form, :closure end end end end
Version data entries
12 entries across 12 versions & 1 rubygems