finalize accounts to sort transactions by date
This commit is contained in:
parent
0f8b579a34
commit
5ba8e2806c
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user