mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-01 03:58:38 -04:00
Hook (almost) everything up to Redux
This commit is contained in:
15
js/utils.js
15
js/utils.js
@ -1,18 +1,19 @@
|
||||
const recursiveAccountDisplayInfo = function(account, prefix) {
|
||||
const recursiveAccountDisplayInfo = function(account, account_map, accountChildren, prefix) {
|
||||
var name = prefix + account.Name;
|
||||
var accounts = [{AccountId: account.AccountId, Name: name}];
|
||||
for (var i = 0; i < account.Children.length; i++)
|
||||
accounts = accounts.concat(recursiveAccountDisplayInfo(account.Children[i], name + "/"));
|
||||
for (var i = 0; i < accountChildren[account.AccountId].length; i++)
|
||||
accounts = accounts.concat(recursiveAccountDisplayInfo(account_map[accountChildren[account.AccountId][i]], account_map, accountChildren, name + "/"));
|
||||
return accounts
|
||||
};
|
||||
|
||||
const getAccountDisplayList = function(account_list, includeRoot, rootName) {
|
||||
const getAccountDisplayList = function(account_map, accountChildren, includeRoot, rootName) {
|
||||
var accounts = []
|
||||
if (includeRoot)
|
||||
accounts.push({AccountId: -1, Name: rootName});
|
||||
for (var i = 0; i < account_list.length; i++) {
|
||||
if (account_list[i].isRootAccount())
|
||||
accounts = accounts.concat(recursiveAccountDisplayInfo(account_list[i], ""));
|
||||
for (var accountId in account_map) {
|
||||
if (account_map.hasOwnProperty(accountId) &&
|
||||
account_map[accountId].isRootAccount())
|
||||
accounts = accounts.concat(recursiveAccountDisplayInfo(account_map[accountId], account_map, accountChildren, ""));
|
||||
}
|
||||
return accounts;
|
||||
};
|
||||
|
Reference in New Issue
Block a user