finalize accounts to sort transactions by date
This commit is contained in:
1 parent
0f8b579a34
commit
5ba8e2806c
3 files changed
+14
No files matched your search
@@ -33,5 +33,11 @@ module Gnucash
|
||||
value: value,
|
||||
}
|
||||
end
|
||||
|
||||
def finalize
|
||||
@transactions.sort! do |a, b|
|
||||
a[:txn].date <=> b[:txn].date
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -15,6 +15,7 @@ module Gnucash
|
||||
@book_node = book_nodes.first
|
||||
build_accounts
|
||||
build_transactions
|
||||
finalize
|
||||
end
|
||||
|
||||
def find_account_by_id(id)
|
||||
@@ -34,5 +35,11 @@ module Gnucash
|
||||
Transaction.new(self, txn_node)
|
||||
end
|
||||
end
|
||||
|
||||
def finalize
|
||||
@accounts.each do |account|
|
||||
account.finalize
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
module Gnucash
|
||||
class Transaction
|
||||
attr_accessor :date
|
||||
attr_accessor :value
|
||||
attr_accessor :id
|
||||
|
||||
|
||||
Reference in new issue
Block a user