Merge pull request #5012 from consul/multiple_answers

Add poll questions that accept multiple answers per user
This commit is contained in:
Senén Rodero
2022-10-18 13:25:02 +02:00
committed by GitHub
52 changed files with 761 additions and 236 deletions

View File

@@ -55,7 +55,7 @@ end
section "Creating Poll Questions & Answers" do
Poll.find_each do |poll|
(1..4).to_a.sample.times do
(3..5).to_a.sample.times do
question_title = Faker::Lorem.sentence(word_count: 3).truncate(60) + "?"
question = Poll::Question.new(author: User.all.sample,
title: question_title,
@@ -84,6 +84,15 @@ section "Creating Poll Questions & Answers" do
end
end
section "Creating Poll Votation types" do
poll = Poll.first
poll.questions.each do |question|
vote_type = VotationType.vote_types.keys.sample
question.create_votation_type!(vote_type: vote_type, max_votes: (3 unless vote_type == "unique"))
end
end
section "Creating Poll Booths & BoothAssignments" do
20.times do |i|
Poll::Booth.create(name: "Booth #{i}",