Reorder before/after create methods

This commit is contained in:
Bertocq
2017-10-03 12:26:43 +02:00
parent 34fbf1472c
commit 332b9be94a

View File

@@ -13,19 +13,21 @@ class Poll
before_create :persist_data
after_create :create_officer_assignments
def create_officer_assignments
booth.booth_assignments.each do |booth_assignment|
attrs = { officer_id: officer_id,
date: date,
booth_assignment_id: booth_assignment.id }
Poll::OfficerAssignment.create!(attrs)
end
end
def persist_data
self.officer_name = officer.name
self.officer_email = officer.email
end
def create_officer_assignments
booth.booth_assignments.each do |booth_assignment|
attrs = {
officer_id: officer_id,
date: date,
booth_assignment_id: booth_assignment.id,
final: recount_scrutiny?
}
Poll::OfficerAssignment.create!(attrs)
end
end
end
end