Skip to content

Commit

Permalink
Added db/seeds for councils, translators and banned competitors (thew…
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljames-dj authored Jul 13, 2024
1 parent 5993a1f commit ae64bf2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
27 changes: 27 additions & 0 deletions db/seeds/development/user_roles.seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@
15.times { FactoryBot.create(:user_role, :inactive, group: group, metadata: FactoryBot.create(:roles_metadata_teams_committees, status: RolesMetadataTeamsCommittees.statuses[:member])) }
end

# Councils
UserGroup.councils.each do |group|
# Current roles
FactoryBot.create(:user_role, :active, group: group, metadata: FactoryBot.create(:roles_metadata_councils, status: RolesMetadataCouncils.statuses[:leader]))
5.times { FactoryBot.create(:user_role, :active, group: group, metadata: FactoryBot.create(:roles_metadata_councils, status: RolesMetadataCouncils.statuses[:member])) }
# Past roles
3.times { FactoryBot.create(:user_role, :inactive, group: group, metadata: FactoryBot.create(:roles_metadata_councils, status: RolesMetadataCouncils.statuses[:leader])) }
15.times { FactoryBot.create(:user_role, :inactive, group: group, metadata: FactoryBot.create(:roles_metadata_councils, status: RolesMetadataCouncils.statuses[:member])) }
end

# Translators
UserGroup.translators.each do |group|
2.times { FactoryBot.create(:user_role, :active, group: group) }
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 All @@ -74,4 +89,16 @@
FactoryBot.create(:treasurer_role, :inactive, user: past_board_roles[8].user)
FactoryBot.create(:treasurer_role, :inactive)
FactoryBot.create(:treasurer_role)

# Banned competitors
5.times {
FactoryBot.create(
:banned_competitor_role,
metadata: FactoryBot.create(
:roles_metadata_banned_competitors,
ban_reason: 'Cheating',
scope: RolesMetadataBannedCompetitors.scopes[:competing_and_attending],
),
)
}
end
6 changes: 6 additions & 0 deletions spec/factories/roles_metadata_banned_competitors.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

FactoryBot.define do
factory :roles_metadata_banned_competitors do
end
end

0 comments on commit ae64bf2

Please sign in to comment.