From 54d9ca3e679456b54a047722a29395324c1380cf Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 18 Nov 2016 20:49:03 +0100 Subject: [PATCH] updates dev seeds with successful proposals --- db/dev_seeds.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 9faacd516..7ca790f1f 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -186,6 +186,28 @@ tags = Faker::Lorem.words(25) puts " #{proposal.title}" end +puts "Creating Successful Proposals" + +tags = Faker::Lorem.words(25) +(1..10).each do |i| + author = User.reorder("RANDOM()").first + description = "

#{Faker::Lorem.paragraphs.join('

')}

" + proposal = Proposal.create!(author: author, + title: Faker::Lorem.sentence(3).truncate(60), + question: Faker::Lorem.sentence(3) + "?", + summary: Faker::Lorem.sentence(3), + responsible_name: Faker::Name.name, + external_url: Faker::Internet.url, + description: description, + created_at: rand((Time.now - 1.week) .. Time.now), + tag_list: tags.sample(3).join(','), + geozone: Geozone.reorder("RANDOM()").first, + terms_of_service: "1", + created_at: 1.month.ago, + cached_votes_up: Setting["votes_for_proposal_success"]) + puts " #{proposal.title}" +end + tags = ActsAsTaggableOn::Tag.where(kind: 'category') (1..30).each do |i| @@ -417,6 +439,18 @@ puts "Creating Poll Question from Proposals" puts " #{question.title} (from proposal)" end +puts "Creating Successfull Proposals" + +(1..10).each do |i| + proposal = Proposal.reorder("RANDOM()").first + poll = Poll.current.first + question = Poll::Question.create(valid_answers: "Yes, No") + question.copy_attributes_from_proposal(proposal) + question.save! + + puts " #{question.title} (from proposal)" +end + puts "Commenting Poll Questions" (1..30).each do |i|