diff --git a/db/seeds.rb b/db/seeds.rb index 02e87c3099..1219fa7d6a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -68,6 +68,7 @@ def active_record_classes LearningHourType, LearningHourTopic, MileageRate, + OtherDuty, Supervisor, SupervisorVolunteer, User, diff --git a/db/seeds/db_populator.rb b/db/seeds/db_populator.rb index ca57427fcd..d6717e44c0 100644 --- a/db/seeds/db_populator.rb +++ b/db/seeds/db_populator.rb @@ -53,6 +53,7 @@ def create_org(options_hash) create_learning_hour_types(casa_org) create_learning_hour_topics(casa_org) create_learning_hours(casa_org) + create_other_duties casa_org end @@ -104,6 +105,24 @@ def create_users(casa_org, options) Volunteer.all.each { |v| v.supervisor = supervisors.sample(random: rng) } end + # Create other duties (Volunteer only) + # Increment other_duties_counter by 1 each time other duty is created + # Print out statement that indicates number of other duties created + + def create_other_duties + Volunteer.find_each do |v| + 2.times { + OtherDuty.create!( + creator_id: v.id, + creator_type: "Volunteer", + occurred_at: Faker::Date.between(from: 2.days.ago, to: Date.today), + duration_minutes: rand(5..180), + notes: Faker::Lorem.sentence + ) + } + end + end + def generate_case_number # CINA-YY-XXXX years = ((DateTime.now.year - 20)..DateTime.now.year).to_a