diff --git a/src/pages/BalanceAssertionsView.vue b/src/pages/BalanceAssertionsView.vue index 8127b4c..83ebb73 100644 --- a/src/pages/BalanceAssertionsView.vue +++ b/src/pages/BalanceAssertionsView.vue @@ -48,8 +48,8 @@ {{ pp(Math.abs(assertion.quantity)) }} {{ assertion.quantity >= 0 ? 'Dr' : 'Cr' }} - - + + @@ -68,6 +68,7 @@ import { invoke } from '@tauri-apps/api/core'; import { ref } from 'vue'; + import { db } from '../db.ts'; import { pp } from '../display.ts'; const balanceAssertions = ref([] as ValidatedBalanceAssertion[]); @@ -83,6 +84,15 @@ } async function load() { + // Since validating the assertions takes a while, first load them from database + const session = await db.load(); + balanceAssertions.value = await session.select( + `SELECT id, dt, description, account, quantity, commodity, NULL as is_valid + FROM balance_assertions + ORDER BY dt DESC, id DESC` + ); + + // Then validate them in the background balanceAssertions.value = JSON.parse(await invoke('get_validated_balance_assertions')); }