Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add partner group to organization. Add new partner for seed #4708

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,18 @@ def random_record_for_org(org, klass)
# ----------------------------------------------------------------------------
Organization.all.each do |org|
# Setup the Partner Group & their item categories
partner_group = FactoryBot.create(:partner_group, organization: org)
partner_group_one = FactoryBot.create(:partner_group, organization: org)

total_item_categories_to_add = Faker::Number.between(from: 1, to: 2)
org.item_categories.sample(total_item_categories_to_add).each do |item_category|
partner_group.item_categories << item_category
partner_group_one.item_categories << item_category
end

next unless org.name == pdx_org.name

partner_group_two = FactoryBot.create(:partner_group, organization: org)
org.item_categories.each do |item_category|
partner_group_two.item_categories << item_category
end
end

Expand Down Expand Up @@ -220,11 +227,22 @@ def random_record_for_org(org, klass)
email: "waiting@example.com",
status: :awaiting_review,
notes: note.sample
},
{
name: "Second Street Community Outreach",
status: :approved,
email: "approved_2@example.com",
notes: note.sample
}
].each do |partner_option|
p = Partner.find_or_create_by!(partner_option) do |partner|
partner.organization = pdx_org
partner.partner_group = pdx_org.partner_groups.first

if partner_option[:name] == "Second Street Community Outreach"
partner.partner_group = pdx_org.partner_groups.find_by(name: 'Group 2')
else
partner.partner_group = pdx_org.partner_groups.first
end
end

profile = Partners::Profile.create!({
Expand Down