From 458d556e510b634b6d89a93e8a1d0005191c0d03 Mon Sep 17 00:00:00 2001 From: Khanh Nguyen <66460089+kstockk@users.noreply.github.com> Date: Sun, 7 Jan 2024 02:09:48 +1100 Subject: [PATCH] added cleared column in csv export (#2138) * added cleared column in csv export * added release note --- .../src/server/accounts/export-to-csv.ts | 21 ++++++++++++++++++- upcoming-release-notes/2138.md | 6 ++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/2138.md diff --git a/packages/loot-core/src/server/accounts/export-to-csv.ts b/packages/loot-core/src/server/accounts/export-to-csv.ts index da8aa17d621..838216cf209 100644 --- a/packages/loot-core/src/server/accounts/export-to-csv.ts +++ b/packages/loot-core/src/server/accounts/export-to-csv.ts @@ -31,13 +31,24 @@ export async function exportToCSV( }, {}); const transactionsForExport = transactions.map( - ({ account, date, payee, notes, category, amount }) => ({ + ({ + account, + date, + payee, + notes, + category, + amount, + cleared, + reconciled, + }) => ({ Account: accountNamesById[account], Date: date, Payee: payeeNamesById[payee], Notes: notes, Category: categoryNamesById[category], Amount: amount == null ? 0 : integerToAmount(amount), + Cleared: cleared, + Reconciled: reconciled, }), ); @@ -57,6 +68,8 @@ export async function exportQueryToCSV(query) { { Notes: 'notes' }, { Category: 'category.name' }, { Amount: 'amount' }, + { Cleared: 'cleared' }, + { Reconciled: 'reconciled' }, ]) .options({ splits: 'all' }), ); @@ -80,6 +93,12 @@ export async function exportQueryToCSV(query) { Notes: trans.Notes, Category: trans.Category, Amount: trans.Amount == null ? 0 : integerToAmount(trans.Amount), + Cleared: + trans.Reconciled === true + ? 'Reconciled' + : trans.Cleared === true + ? 'Cleared' + : 'Not cleared', }; }); diff --git a/upcoming-release-notes/2138.md b/upcoming-release-notes/2138.md new file mode 100644 index 00000000000..9fd1d8b80bf --- /dev/null +++ b/upcoming-release-notes/2138.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [kstockk] +--- + +Add cleared column in csv export