JackDanger (owner)

Forks

Revisions

gist: 118278 Download_button fork
public
Public Clone URL: git://gist.github.com/118278.git
Embed All Files: show embed
CaseHawk Test Data #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
gem 'faker'
require 'faker'
 
# Clean out what is there
Event.delete_all if ENV['CLEAR']
 
# Makes a bunch of different types of events per day at a random time during work hours
(45.days.ago.to_date..56.days.from_now.to_date).each do |date|
  rand(15).times do
    start = date.beginning_of_day + 8.hours + (rand(32) * 15).minutes
    Appointment.create :creator => User.find(:first, :order => 'rand()'),
                       :starts_at => start,
                       :account_id=> 1,
                       :ends_at => start + (rand(16) * 15).minutes,
                       :name => "Meet with #{Faker::Name.name}"
  end
  rand(5).times do
    event = %w(birthday vacation sick trial).rand
    AllDay.create :creator => User.find(:first, :order => rand()),
                  :starts_at => date,
                  :account_id=> 1,
                  :ends_at => date + rand(7).days,
                  :name => "#{Faker::Name.name}'s #{event}"
  end
  rand(6).times do
    Task.create :creator => User.find(:first, :order => rand()),
                :starts_at => date,
                :account_id => 1,
                :name => "Help #{Faker::Name.name} with FinDec"
  end
  rand(8).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 => 1,
                    :name => "File docs for #{Faker::Name.name}"
  end
  
end