From 071e7156c56cdbc231dbb149df04dbb257063b51 Mon Sep 17 00:00:00 2001 From: Donnie Ashok Date: Tue, 30 Jan 2024 20:55:44 +0100 Subject: [PATCH] v1.0.26 - Use currency from credit entry (#26) * v1.0.26 - Use currency from credit entry * v1.0.26 - Version --- README.md | 4 ++-- lib/db/months.dart | 27 +++++++++------------------ pubspec.yaml | 2 +- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 0515c86..b0b6ee6 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ - - + + diff --git a/lib/db/months.dart b/lib/db/months.dart index a758960..4507e46 100644 --- a/lib/db/months.dart +++ b/lib/db/months.dart @@ -50,33 +50,28 @@ class MonthService { e1.updated_at, e1.debit_account_id, e2.credit_account_id, - (CASE - WHEN f.debit_currency = ? THEN e1.amount - ELSE e2.amount - END) AS amount, + e2.amount, e1.date, e2.notes, - (CASE - WHEN f.debit_currency = ? THEN ? - ELSE f.credit_currency - END) AS currency + f.credit_currency AS currency FROM ForexPairs f JOIN entries e1 ON f.debit_entry_id = e1.id JOIN entries e2 ON f.credit_entry_id = e2.id ), - NonForexEntries AS ( - SELECT *, ? AS currency - FROM entries - WHERE id NOT IN (SELECT debit_entry_id FROM ForexPairs) - AND id NOT IN (SELECT credit_entry_id FROM ForexPairs) + NormalEntries AS ( + SELECT e.*, ac.currency AS currency + FROM entries e + JOIN accounts ac ON e.credit_account_id = ac.id + WHERE e.id NOT IN (SELECT debit_entry_id FROM ForexPairs) + AND e.id NOT IN (SELECT credit_entry_id FROM ForexPairs) ), ConsolidatedEntries AS ( SELECT * FROM ConsolidatedForex UNION ALL SELECT * - FROM NonForexEntries + FROM NormalEntries ), MonthlyTotals AS ( SELECT @@ -145,10 +140,6 @@ class MonthService { final results = await dbClient.rawQuery( query, [ - prefCurrency, - prefCurrency, - prefCurrency, - prefCurrency, prefCurrency, prefCurrency, prefCurrency, diff --git a/pubspec.yaml b/pubspec.yaml index f7120cf..99828e4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: finease description: "A full stack mobile app to keep track of financial transactions" publish_to: 'none' -version: 1.0.25 +version: 1.0.26 environment: sdk: '>=3.2.3 <4.0.0'