Skip to content

Commit

Permalink
Feature: A group and user for each SOFIA role in the database seed (#412
Browse files Browse the repository at this point in the history
)

* Added groups for SOFIA roles

* Fixed members and groups for sofia

* Fixed Lint

---------

Co-authored-by: lodewiges <[email protected]>
  • Loading branch information
Ellen-Wittingen and lodewiges authored Nov 22, 2024
1 parent 40cd931 commit ae509a8
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions db/seeds/users_and_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
bestuur = Group.create!(name: 'Bestuur', kind: 'bestuur', description: 'Wij zijn de echte bazen',
recognized_at_gma: 'ALV 21', rejected_at_gma: 'ALV 218')

sofia_treasurers = Group.create!(name: 'SOFIA Penningmeester', kind: 'bestuur',
administrative: true)

sofia_renting_managers = Group.create!(name: 'SOFIA Verhuur Manager', kind: 'bestuur',
administrative: true)

sofia_main_bartenders = Group.create!(name: 'SOFIA Hoofdtappers', kind: 'groep')

old_members_group = Group.create!(name: 'Oud-Leden', kind: 'groep',
description: 'Oud-Alphanen, verenigt u!')

Expand All @@ -25,6 +33,21 @@
password: 'password1234',
password_confirmation: 'password1234')

sofia_treasurer = FactoryBot.create(:user, activated_at: Time.zone.now)
sofia_treasurer.update(username: 'sofia_treasurer',
password: 'password1234',
password_confirmation: 'password1234')

sofia_renting_manager = FactoryBot.create(:user, activated_at: Time.zone.now)
sofia_renting_manager.update(username: 'sofia_renting_manager',
password: 'password1234',
password_confirmation: 'password1234')

sofia_bartenders = FactoryBot.create_list(:user, 6, activated_at: Time.zone.now)
sofia_bartenders.first.update(username: 'sofia_main_bartender',
password: 'password1234',
password_confirmation: 'password1234')

old_members = FactoryBot.create_list(:user, 8, activated_at: Time.zone.now)
old_members.first.update(username: 'oudlid',
password: 'password1234',
Expand All @@ -49,6 +72,23 @@
function: Faker::Job.title)
end

Membership.create(user: sofia_treasurer, group: sofia_treasurers,
start_date: Date.current.months_ago(10))
Membership.create(user: sofia_treasurer, group: member_group,
start_date: Date.current.months_ago(4), function: Faker::Job.title)

Membership.create(user: sofia_renting_manager, group: sofia_renting_managers,
start_date: Date.current.months_ago(10))
Membership.create(user: sofia_renting_manager, group: member_group,
start_date: Date.current.months_ago(4), function: Faker::Job.title)

sofia_bartenders.each do |user|
Membership.create(user:, group: sofia_main_bartenders,
start_date: Date.current.months_ago(10), function: Faker::Job.title)
Membership.create(user:, group: member_group, start_date: Date.current.months_ago(4),
function: Faker::Job.title)
end

old_members.each do |user|
Membership.create(user:, group: old_members_group, start_date: Date.current.months_ago(10),
function: Faker::Job.title)
Expand Down

0 comments on commit ae509a8

Please sign in to comment.