Increase dev seeds creating communities, topics and comments on topics & polls
This commit is contained in:
@@ -614,13 +614,36 @@ section "Creating Poll Shifts for Poll Officers" do
|
||||
end
|
||||
end
|
||||
|
||||
section "Commenting Poll Questions" do
|
||||
section "Creating Communities" do
|
||||
Proposal.all.each { |proposal| proposal.update(community: Community.create) }
|
||||
Budget::Investment.all.each { |investment| investment.update(community: Community.create) }
|
||||
end
|
||||
|
||||
section "Creating Communities Topics" do
|
||||
Community.all.each do |community|
|
||||
Topic.create(community: community, author: User.all.sample,
|
||||
title: Faker::Lorem.sentence(3).truncate(60), description: Faker::Lorem.sentence)
|
||||
end
|
||||
end
|
||||
|
||||
section "Commenting Polls" do
|
||||
30.times do
|
||||
author = User.all.sample
|
||||
question = Poll::Question.all.sample
|
||||
poll = Poll.all.sample
|
||||
Comment.create!(user: author,
|
||||
created_at: rand(question.created_at..Time.current),
|
||||
commentable: question,
|
||||
created_at: rand(poll.created_at..Time.current),
|
||||
commentable: poll,
|
||||
body: Faker::Lorem.sentence)
|
||||
end
|
||||
end
|
||||
|
||||
section "Commenting Community Topics" do
|
||||
30.times do
|
||||
author = User.all.sample
|
||||
topic = Topic.all.sample
|
||||
Comment.create!(user: author,
|
||||
created_at: rand(topic.created_at..Time.current),
|
||||
commentable: topic,
|
||||
body: Faker::Lorem.sentence)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user