From 1d0a79e33c562550e66579ce2330e0225b09acef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 5 Mar 2023 17:38:17 +0800 Subject: [PATCH] Changed the CSV field name to be title-cased. --- src/accounting/report/report_rows.py | 34 ++++++++++++++-------------- src/accounting/report/reports.py | 6 ++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/accounting/report/report_rows.py b/src/accounting/report/report_rows.py index 24e1b8e..7e67e84 100644 --- a/src/accounting/report/report_rows.py +++ b/src/accounting/report/report_rows.py @@ -62,13 +62,13 @@ class JournalRow(ReportRow): """The account.""" def as_dict(self) -> dict[str, t.Any]: - return {"date": self.transaction.date, - "currency": str(self.currency), - "account": str(self.account), - "summary": self.summary, - "debit": self.amount if self.is_debit else None, - "credit": None if self.is_debit else self.amount, - "note": self.transaction.note} + return {"Date": self.transaction.date, + "Currency": str(self.currency), + "Account": str(self.account), + "Summary": self.summary, + "Debit": self.amount if self.is_debit else None, + "Credit": None if self.is_debit else self.amount, + "Note": self.transaction.note} class LedgerRow(ReportRow): @@ -103,13 +103,13 @@ class LedgerRow(ReportRow): def as_dict(self) -> dict[str, t.Any]: if self.is_total: - return {"date": "Total", - "summary": None, - "debit": self.debit, - "credit": self.credit, - "balance": self.balance} - return {"date": self.date, - "summary": self.summary, - "debit": self.debit, - "credit": self.credit, - "balance": self.balance} + return {"Date": "Total", + "Summary": None, + "Debit": self.debit, + "Credit": self.credit, + "Balance": self.balance} + return {"Date": self.date, + "Summary": self.summary, + "Debit": self.debit, + "Credit": self.credit, + "Balance": self.balance} diff --git a/src/accounting/report/reports.py b/src/accounting/report/reports.py index e004b34..d975cb8 100644 --- a/src/accounting/report/reports.py +++ b/src/accounting/report/reports.py @@ -198,8 +198,8 @@ class Journal(JournalEntryReport[JournalRow]): @property def csv_field_names(self) -> list[str]: - return ["date", "currency", "account", "summary", "debit", "credit", - "note"] + return ["Date", "Currency", "Account", "Summary", "Debit", "Credit", + "Note"] @property def csv_filename(self) -> str: @@ -345,7 +345,7 @@ class Ledger(JournalEntryReport[LedgerRow]): @property def csv_field_names(self) -> list[str]: - return ["date", "summary", "debit", "credit", "balance"] + return ["Date", "Summary", "Debit", "Credit", "Balance"] @property def csv_filename(self) -> str: