Skip to content

Commit

Permalink
Added db/seeds for delegate roles & probation roles
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljames-dj committed Jun 23, 2024
1 parent 1e2d8f8 commit ea01e23
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions db/seeds/development/user_roles.seeds.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
# frozen_string_literal: true

after :user_groups do
# Delegates on probation roles
3.times { FactoryBot.create!(:probation_role) }
9.times { FactoryBot.create!(:probation_role, :inactive) }

# Delegate roles
UserGroup.root_groups.delegate_regions.each do |group|
# Senior Delegate
FactoryBot.create!(:senior_delegate_role, group: group)
# Past Senior Delegates
2.times { FactoryBot.create!(:senior_delegate_role, :inactive, group: group) }

if group.all_child_groups.any?
group.all_child_groups.each do |child_group|
# Regional Delegate
FactoryBot.create!(:regional_delegate_role, group: child_group)
# Past Regional Delegates
2.times { FactoryBot.create!(:regional_delegate_role, :inactive, group: child_group) }
# Delegates
4.times { FactoryBot.create!(:delegate_role, group: group) }
3.times { FactoryBot.create!(:junior_delegate_role, group: group) }
2.times { FactoryBot.create!(:trainee_delegate_role, group: group) }
# Past Delegates
12.times { FactoryBot.create!(:delegate_role, :inactive, group: group) }
9.times { FactoryBot.create!(:junior_delegate_role, :inactive, group: group) }
6.times { FactoryBot.create!(:trainee_delegate_role, :inactive, group: group) }
end
end
end

# Board Roles
past_board_roles = 9.times.collect { |index| FactoryBot.create!(:board_role, :inactive) }
current_board_roles = 4.times.collect { |index| FactoryBot.create!(:board_role, :active) }
Expand Down

0 comments on commit ea01e23

Please sign in to comment.