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