# == Schema Information # # Table name: tasks # # id :integer not null, primary key # user_id :integer # assigned_to :integer # completed_by :integer # name :string(255) default(""), not null # asset_id :integer # asset_type :string(255) # priority :string(32) # category :string(32) # bucket :string(32) # due_at :datetime # completed_at :datetime # deleted_at :datetime # created_at :datetime # updated_at :datetime # background_info :string(255) # <% require "ffaker" puts "Loading tasks..." category = %w(call email follow_up lunch meeting money presentation trip) << "" for i in (1 .. 250) do case rand(12) when 1 # ASAP due_at = nil bucket = "due_asap" when 2..8 # tomorrow/next week due_at = Date.today + rand(15).days bucket = (due_at == Date.tomorrow ? "due_tomorrow" : "due_next_week") when 9..11 # overdue due_at = Date.today - rand(15).days bucket = "due_tomorrow" else # later due_at = nil bucket = "due_later" end user = rand(8) + 1 asset = (i % 5 == 0 ? rand(10) + 1 : nil) completed_by = rand(4) == 0 ? user : nil %> task<%= i %>: id : <%= i %> user_id : <%= user %> assigned_to : <%= rand(4) == 0 ? rand(5) + 1 : "" %> completed_by : <%= completed_by %> name : <%= Faker::Lorem::sentence(rand(2) + 2).sub(".", "") %> asset_id : <%= asset %> asset_type : <%= %w(Account Campaign Contact Lead Opportunity).sample if asset %> category : <%= category.sample %> bucket : <%= bucket %> background_info : # background_info : <%= Faker::Lorem.paragraph[0,255] %> due_at : <%= due_at %> completed_at : <%= completed_by ? Date.today - rand(5).days : "" %> created_at : <%= created_at = (rand(60) + 2).days.ago + rand(600).minutes; created_at.to_s(:db) %> updated_at : <%= (created_at + rand(36_000).seconds).to_s(:db) %> <% end %>