Add column and use instead of last transactions date
This commit is contained in:
@ -20,9 +20,12 @@ const OnBudgetAccountsBalance = computed(() => accountStore.OnBudgetAccountsBala
|
||||
const OffBudgetAccountsBalance = computed(() => accountStore.OffBudgetAccountsBalance);
|
||||
|
||||
function isRecentlyReconciled(account: Account) {
|
||||
if(!account.LastReconciled.Valid)
|
||||
return false;
|
||||
|
||||
const now = new Date().getTime();
|
||||
const recently = 7 * 24 * 60 * 60 * 1000;
|
||||
return new Date(now - recently).getTime() < account.LastReconciled.getTime();
|
||||
return new Date(now - recently).getTime() < account.LastReconciled.Time.getTime();
|
||||
}
|
||||
|
||||
function getAccountName(account: Account) {
|
||||
|
@ -21,7 +21,12 @@ export interface Account {
|
||||
WorkingBalance: number
|
||||
ReconciledBalance: number
|
||||
Transactions: string[]
|
||||
LastReconciled: Date
|
||||
LastReconciled: NullDate
|
||||
}
|
||||
|
||||
interface NullDate {
|
||||
Valid: boolean
|
||||
Time: Date
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
|
@ -58,7 +58,8 @@ export const useBudgetsStore = defineStore('budget', {
|
||||
for (const account of response.Accounts || []) {
|
||||
const existingAccount = accounts.Accounts.get(account.ID);
|
||||
account.Transactions = existingAccount?.Transactions ?? [];
|
||||
account.LastReconciled = new Date(account.LastReconciled);
|
||||
if(account.LastReconciled.Valid)
|
||||
account.LastReconciled.Time = new Date(account.LastReconciled.Time);
|
||||
accounts.Accounts.set(account.ID, account);
|
||||
}
|
||||
for (const category of response.Categories || []) {
|
||||
|
Reference in New Issue
Block a user