adds recounts and results to dev seeds

This commit is contained in:
rgarcia
2017-10-18 18:44:24 +02:00
parent 9a4364bf0c
commit cd148dfbf0

View File

@@ -640,6 +640,49 @@ print "Creating Poll Voters"
Poll::Voter.create(poll: poll, user: user)
end
puts ""
print "Creating Poll Recounts"
Poll.all.each do |poll|
poll.booth_assignments.each do |booth_assignment|
officer_assignment = poll.officer_assignments.first
author = Poll::Officer.first.user
Poll::Recount.create!(officer_assignment: officer_assignment,
booth_assignment: booth_assignment,
author: author,
date: poll.ends_at,
white_amount: rand(0..10),
null_amount: rand(0..10),
total_amount: rand(100..9999),
origin: "booth")
end
end
puts ""
print "Creating Poll Results"
Poll.all.each do |poll|
poll.booth_assignments.each do |booth_assignment|
officer_assignment = poll.officer_assignments.first
author = Poll::Officer.first.user
poll.questions.each do |question|
question.question_answers.each do |answer|
Poll::PartialResult.create!(officer_assignment: officer_assignment,
booth_assignment: booth_assignment,
date: Date.current,
question: question,
answer: answer.title,
author: author,
amount: rand(999),
origin: "booth")
end
end
end
end
puts ""
print "Creating legislation processes"