diff --git a/crud.py b/crud.py
index 6d5285a..b25bacb 100644
--- a/crud.py
+++ b/crud.py
@@ -796,7 +796,31 @@ async def create_balance_assertion(
created_at=datetime.now(),
)
- await db.insert("balance_assertions", assertion, convert_decimal=True)
+ # Manually insert with Decimal fields converted to strings
+ await db.execute(
+ """
+ INSERT INTO balance_assertions (
+ id, date, account_id, expected_balance_sats, expected_balance_fiat,
+ fiat_currency, tolerance_sats, tolerance_fiat, status, created_by, created_at
+ ) VALUES (
+ :id, :date, :account_id, :expected_balance_sats, :expected_balance_fiat,
+ :fiat_currency, :tolerance_sats, :tolerance_fiat, :status, :created_by, :created_at
+ )
+ """,
+ {
+ "id": assertion.id,
+ "date": assertion.date,
+ "account_id": assertion.account_id,
+ "expected_balance_sats": assertion.expected_balance_sats,
+ "expected_balance_fiat": str(assertion.expected_balance_fiat) if assertion.expected_balance_fiat else None,
+ "fiat_currency": assertion.fiat_currency,
+ "tolerance_sats": assertion.tolerance_sats,
+ "tolerance_fiat": str(assertion.tolerance_fiat),
+ "status": assertion.status.value,
+ "created_by": assertion.created_by,
+ "created_at": assertion.created_at,
+ },
+ )
return assertion
diff --git a/static/js/index.js b/static/js/index.js
index f6c75cd..4eab35c 100644
--- a/static/js/index.js
+++ b/static/js/index.js
@@ -70,7 +70,7 @@ window.app = Vue.createApp({
assertionDialog: {
show: false,
account_id: '',
- expected_balance_sats: null,
+ expected_balance_sats: 0,
expected_balance_fiat: null,
fiat_currency: null,
tolerance_sats: 0,
@@ -646,7 +646,7 @@ window.app = Vue.createApp({
this.assertionDialog = {
show: false,
account_id: '',
- expected_balance_sats: null,
+ expected_balance_sats: 0,
expected_balance_fiat: null,
fiat_currency: null,
tolerance_sats: 0,
@@ -677,12 +677,6 @@ window.app = Vue.createApp({
}
},
async recheckAssertion(assertionId) {
- // Set loading state
- const assertion = this.balanceAssertions.find(a => a.id === assertionId)
- if (assertion) {
- this.$set(assertion, 'rechecking', true)
- }
-
try {
await LNbits.api.request(
'POST',
@@ -699,19 +693,9 @@ window.app = Vue.createApp({
await this.loadBalanceAssertions()
} catch (error) {
LNbits.utils.notifyApiError(error)
- } finally {
- if (assertion) {
- this.$set(assertion, 'rechecking', false)
- }
}
},
async deleteAssertion(assertionId) {
- // Set loading state
- const assertion = this.balanceAssertions.find(a => a.id === assertionId)
- if (assertion) {
- this.$set(assertion, 'deleting', true)
- }
-
try {
await LNbits.api.request(
'DELETE',
@@ -728,10 +712,6 @@ window.app = Vue.createApp({
await this.loadBalanceAssertions()
} catch (error) {
LNbits.utils.notifyApiError(error)
- } finally {
- if (assertion) {
- this.$set(assertion, 'deleting', false)
- }
}
},
getAccountName(accountId) {
diff --git a/templates/castle/index.html b/templates/castle/index.html
index 2290d88..43f65e5 100644
--- a/templates/castle/index.html
+++ b/templates/castle/index.html
@@ -302,7 +302,6 @@
round
icon="refresh"
@click="recheckAssertion(assertion.id)"
- :loading="assertion.rechecking"
>