Created
February 1, 2010 16:38
-
-
Save robertpfeiffer/291806 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
From 06311538cd292e01cd5a720eb900cc92b8121a21 Mon Sep 17 00:00:00 2001 | |
From: robert.pfeiffer <robert.pfeiffer@0edcaff0-1f94-41fd-a3cc-b4922521d3a4> | |
Date: Thu, 28 Jan 2010 16:45:04 +0000 | |
Subject: [PATCH] populate task | |
git-svn-id: svn+ssh://svn.hpi.uni-potsdam.de/svn/branches/accounting@2729 0edcaff0-1f94-41fd-a3cc-b4922521d3a4 | |
--- | |
lib/tasks/populate.rake | 6 +++- | |
lib/tasks/populate_accounting.rake | 42 ++++++++++++++++++++++++++++++++++++ | |
2 files changed, 46 insertions(+), 2 deletions(-) | |
create mode 100644 lib/tasks/populate_accounting.rake | |
diff --git a/lib/tasks/populate.rake b/lib/tasks/populate.rake | |
index 2d8aff4..0bf5a4e 100644 | |
--- a/lib/tasks/populate.rake | |
+++ b/lib/tasks/populate.rake | |
@@ -3,7 +3,8 @@ namespace :db do | |
################################ | |
# add your task here - order is important when your task depends on others | |
############################### | |
- populate_tasks = [:populate_agb, | |
+ populate_tasks = [:seed_accounting, | |
+ :populate_agb, | |
:populate_bank_account, | |
:populate_country, | |
:populate_accounts_and_contacts, | |
@@ -12,6 +13,7 @@ namespace :db do | |
:populate_order, | |
:populate_invoice, | |
:populate_lead, | |
+ :populate_accounting, | |
:populate_task] | |
task :populate => populate_tasks do | |
@@ -57,4 +59,4 @@ namespace :db do | |
end | |
end | |
end | |
-end | |
\ No newline at end of file | |
+end | |
diff --git a/lib/tasks/populate_accounting.rake b/lib/tasks/populate_accounting.rake | |
new file mode 100644 | |
index 0000000..1034b2c | |
--- /dev/null | |
+++ b/lib/tasks/populate_accounting.rake | |
@@ -0,0 +1,42 @@ | |
+namespace :db do | |
+ desc "Populate tasks" | |
+ task :populate_accounting => :prepare_populate do | |
+ Record.delete_all | |
+ | |
+ Record.populate 100 do |record| | |
+ copy_factory_attributes(:eigenkapitalmehrung, record) | |
+ record.amount = rand(200000) | |
+ record.credit_id = BkAsset.all.map(&:id) | |
+ record.debit_id = Liability.all.map(&:id) | |
+ record.description = "eigenkapitalmehrung" | |
+ record.committed = true | |
+ end | |
+ | |
+ Record.populate 100 do |record| | |
+ copy_factory_attributes(:record, record) | |
+ record.amount = rand(200000) | |
+ record.debit_id = BkAsset.all.map(&:id) | |
+ record.credit_id = Expense.all.map(&:id) | |
+ record.description = "Rechnung zahlen" | |
+ record.committed = true | |
+ end | |
+ | |
+ Record.populate 100 do |record| | |
+ copy_factory_attributes(:record, record) | |
+ record.amount = rand(200000) | |
+ record.debit_id = BkAsset.all.map(&:id) | |
+ record.credit_id = BkAsset.all.map(&:id) | |
+ record.description = "Hin und her" | |
+ record.committed = true | |
+ end | |
+ | |
+ Record.populate 100 do |record| | |
+ copy_factory_attributes(:record, record) | |
+ record.amount = rand(200000) | |
+ record.debit_id = Income.all.map(&:id) | |
+ record.credit_id = BkAsset.all.map(&:id) | |
+ record.description = "Umsatz" | |
+ record.committed = true | |
+ end | |
+ end | |
+end | |
-- | |
1.6.6 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment