adds recounts and results to dev seeds
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user