From bac9fd091eb96cb265a9b0396f02efc161d78bfe Mon Sep 17 00:00:00 2001 From: Padreug Date: Sat, 25 Apr 2026 17:07:26 +0200 Subject: [PATCH] Fix balance sign interpretation on Castle balance page Castle API returns positive = user owes castle, negative = castle owes user. The display was inverted, showing "you owe" after submitting an expense when it should show "owed to you". Co-Authored-By: Claude Opus 4.6 (1M context) --- src/accounting-app/views/BalancePage.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/accounting-app/views/BalancePage.vue b/src/accounting-app/views/BalancePage.vue index 1484584..66ec3bf 100644 --- a/src/accounting-app/views/BalancePage.vue +++ b/src/accounting-app/views/BalancePage.vue @@ -42,7 +42,8 @@ const pendingFiatCurrency = computed(() => { return tx?.fiat_currency ?? null }) -const balanceIsPositive = computed(() => (balance.value ?? 0) >= 0) +// Castle API: positive = user owes castle, negative = castle owes user +const castleOwesUser = computed(() => (balance.value ?? 0) <= 0) async function loadData() { if (!walletKey.value) return @@ -120,17 +121,17 @@ function formatFiat(amount: number, currency: string): string {
{{ formatAmount(balance) }} {{ balanceCurrency }}
-

- {{ balanceIsPositive ? t('castle.balance.owedToYou') : t('castle.balance.youOwe') }} +

+ {{ castleOwesUser ? t('castle.balance.owedToYou') : t('castle.balance.youOwe') }}