update track-investments so that it uses SimpleFIN IDs instead of names to match accounts

This commit is contained in:
Robert Dyer
2024-08-10 18:41:48 -05:00
parent a6cd5dee0d
commit b7c5000883
2 changed files with 19 additions and 4 deletions
+13
View File
@@ -140,6 +140,19 @@ const Utils = {
});
},
getSimpleFinID: async function (account) {
const data = await api.runQuery(
api.q('accounts')
.filter({ id: account.id })
.filter({ account_sync_source: 'simpleFin' })
.select('account_id')
);
if (data.data.length && data.data[0].account_id) {
return data.data[0].account_id;
}
return undefined;
},
sleep: function (ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);