Adds Ballot Sheet model and business logic

This commit is contained in:
María Checa
2018-06-21 22:34:54 +02:00
committed by Javi Martín
parent ccf8d3a8e2
commit 394177213c
18 changed files with 294 additions and 115 deletions

View File

@@ -19,13 +19,13 @@ class Officing::BallotSheetsController < Officing::BaseController
def create
load_officer_assignment
check_officer_assignment
@ballot_sheet = Poll::BallotSheet.new(ballot_sheet_params)
if @ballot_sheet.save
redirect_to officing_poll_ballot_sheet_path(@poll, @ballot_sheet)
else
flash.now[:alert] = @ballot_sheet.errors.full_messages.join(", ")
render :new
end
end
@@ -63,13 +63,6 @@ class Officing::BallotSheetsController < Officing::BaseController
.find_by(id: ballot_sheet_params[:officer_assignment_id])
end
def check_officer_assignment
if @officer_assignment.blank?
flash.now[:alert] = t("officing.results.flash.error_wrong_booth")
render :new
end
end
def ballot_sheet_params
params.permit(:data, :poll_id, :officer_assignment_id)
end