Class: Decidim::Elections::Admin::EndVote
- Inherits:
-
Command
- Object
- Command
- Decidim::Elections::Admin::EndVote
- Defined in:
- app/commands/decidim/elections/admin/end_vote.rb
Overview
This command gets called to end the voting period in the Bulletin Board.
Instance Method Summary collapse
-
#call ⇒ Object
Public: Ends the voting period for the Election.
-
#initialize(form) ⇒ EndVote
constructor
Public: Initializes the command.
Constructor Details
#initialize(form) ⇒ EndVote
Public: Initializes the command.
form - A VotePeriodForm object with the information needed to start or end the vote period
11 12 13 |
# File 'app/commands/decidim/elections/admin/end_vote.rb', line 11 def initialize(form) @form = form end |
Instance Method Details
#call ⇒ Object
Public: Ends the voting period for the Election.
Broadcasts :ok if setup, :invalid otherwise.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/commands/decidim/elections/admin/end_vote.rb', line 18 def call return broadcast(:invalid) if form.invalid? transaction do log_action end_vote end broadcast(:ok) rescue StandardError => e broadcast(:invalid, e.) end |