Skip to content

Commit

Permalink
Merge pull request #883 from sharvy/added-mandatory-fields-in-seed-files
Browse files Browse the repository at this point in the history
Seed files need to be updated to reflect latest changes, and to run without validation error.
  • Loading branch information
h-m-m authored Mar 5, 2021
2 parents bd26c0a + 2ad938d commit 5bb5a1a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/models/importers/submission_response_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,12 @@ def create_submission_response_from_row(row, question, submission)
end

def create_organization_community_resource
CommunityResource.where(organization: @current_organization).first_or_create!(is_created_by_admin: true, name: 'PLACEHOLDER')
CommunityResource.where(organization: @current_organization).first_or_create!(
is_created_by_admin: true,
name: 'PLACEHOLDER',
description: 'DESCRIPTION PLACEHOLDER',
publish_from: Date.current
)
end

def create_listings_data_from_category_questions(row, submission)
Expand Down
11 changes: 9 additions & 2 deletions db/seeds/dev_seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@
# organization
org = Organization.where(name: "Diaper Bank").first_or_create!
# community_resources
CommunityResource.where(name: "this is diapers for you", description: "first come first serve", organization: org).first_or_create!
CommunityResource.where(
name: "this is diapers for you",
description: "first come first serve",
organization: org
).first_or_create!(publish_from: Faker::Time.between(from: Time.now - 20.days, to: DateTime.now))
5.times do
org = Organization.create!(name: Faker::Company.name)
CommunityResource.create!(name: Faker::Lorem.words(number: (2..5).to_a.sample).join(" "),
Expand All @@ -97,7 +101,10 @@
end

# announcements
Announcement.where(name: "Lansing urgent care are sharing free face masks", description: "Announcement announcement urgent care! Free masks!").first_or_create!
Announcement.where(
name: "Lansing urgent care are sharing free face masks",
description: "Announcement announcement urgent care! Free masks!",
).first_or_create!(publish_from: Faker::Time.between(from: Time.now - 20.days, to: DateTime.now))
5.times do
Announcement.create!(name: Faker::Lorem.words(number: (2..5).to_a.sample).join(" "),
is_approved: [true,false].sample,
Expand Down

0 comments on commit 5bb5a1a

Please sign in to comment.