2015-09-11 17:26:23 +02:00
|
|
|
unless Rails.env.production?
|
2019-05-30 11:08:46 +02:00
|
|
|
require 'factory_bot'
|
2015-09-11 17:26:23 +02:00
|
|
|
require 'faker'
|
|
|
|
task :sow => :environment do
|
2019-05-30 11:08:46 +02:00
|
|
|
users = FactoryBot.create_list(:user, 20)
|
2015-09-11 17:26:23 +02:00
|
|
|
100.times do
|
|
|
|
sample_users = users.sample(2)
|
2019-05-30 11:08:46 +02:00
|
|
|
FactoryBot.create :transaction, debtor: sample_users[0], creditor: sample_users[1]
|
2015-09-14 16:50:47 +02:00
|
|
|
end
|
2019-05-30 11:08:46 +02:00
|
|
|
clients = FactoryBot.create_list(:client, 5)
|
2015-09-14 16:50:47 +02:00
|
|
|
100.times do
|
|
|
|
debtor, creditor = users.sample(2)
|
2019-05-30 11:08:46 +02:00
|
|
|
FactoryBot.create :client_transaction, issuer: clients.sample, debtor: debtor, creditor: creditor
|
2015-09-11 17:26:23 +02:00
|
|
|
end
|
2015-09-08 16:45:46 +02:00
|
|
|
end
|
|
|
|
end
|