-
-
Save brookr/118332 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem 'faker' | |
| require 'faker' | |
| # Clean out what is there | |
| # Makes a bunch of different types of events per day at a random time during work hours | |
| account_id ||= 1 | |
| (30.days.ago.to_date..90.days.from_now.to_date).each do |date| | |
| rand(5).times do | |
| start = date.beginning_of_day + 8.hours + (rand(32) * 15).minutes | |
| Appointment.create :creator => User.find(:first, :order => 'rand()'), | |
| :starts_at => start, | |
| :ends_at => start + (rand(16) * 15).minutes, | |
| :account_id => account_id, | |
| :name => "Meet with #{Faker::Name.name}" | |
| end | |
| rand(3).times do | |
| event = %w(birthday vacation sick trial).sample | |
| AllDay.create :creator => User.find(:first, :order => rand()), | |
| :starts_at => date, | |
| :ends_at => date + rand(4).days, | |
| :account_id => account_id, | |
| :name => "#{Faker::Name.name}'s #{event}" | |
| end | |
| rand(4).times do | |
| CourtDate.create :creator => User.find(:first, :order => rand()), | |
| :starts_at => date, | |
| :ends_at => start + ((3..5).to_a.sample * 15).minutes, | |
| :account_id => account_id, | |
| :name => "Help #{Faker::Name.name} with FinDec" | |
| end | |
| rand(4).times do | |
| Task.create :creator => User.find(:first, :order => rand()), | |
| :starts_at => date, | |
| :account_id => account_id, | |
| :name => "Help #{Faker::Name.name} with FinDec" | |
| end | |
| rand(4).times do | |
| start = date.beginning_of_day + 8.hours + (rand(32) * 15).minutes | |
| Deadline.create :creator => User.find(:first, :order => rand()), | |
| :starts_at => start, | |
| :account_id => account_id, | |
| :name => "File docs for #{Faker::Name.name}" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment