cli: Commands.Balance.multiBalanceRowAsTextBuilders, multiBalanceReportAsCsvHelper: helper functions removed

This commit is contained in:
Henning Thielemann 2024-09-05 10:46:46 +02:00 committed by Simon Michael
parent ff397f79cc
commit 5a7d0687d5

View File

@ -689,18 +689,14 @@ amountType bopts amt =
multiBalanceReportAsCsv :: ReportOpts -> MultiBalanceReport -> CSV multiBalanceReportAsCsv :: ReportOpts -> MultiBalanceReport -> CSV
multiBalanceReportAsCsv opts@ReportOpts{..} report = maybeTranspose allRows multiBalanceReportAsCsv opts@ReportOpts{..} report = maybeTranspose allRows
where where
allRows = case layout_ of allRows =
rawTableContent $
case layout_ of
LayoutTidy -> rows -- tidy csv should not include totals or averages LayoutTidy -> rows -- tidy csv should not include totals or averages
_ -> rows ++ totals _ -> rows ++ totals
(rows, totals) = multiBalanceReportAsCsvHelper False opts report (rows, totals) = multiBalanceReportAsSpreadsheetHelper False opts report
maybeTranspose = if transpose_ then transpose else id maybeTranspose = if transpose_ then transpose else id
-- Helper for CSV (and HTML) rendering.
multiBalanceReportAsCsvHelper :: Bool -> ReportOpts -> MultiBalanceReport -> (CSV, CSV)
multiBalanceReportAsCsvHelper ishtml opts =
(rawTableContent *** rawTableContent) .
multiBalanceReportAsSpreadsheetHelper ishtml opts
-- Helper for CSV and ODS and HTML rendering. -- Helper for CSV and ODS and HTML rendering.
multiBalanceReportAsSpreadsheetHelper :: multiBalanceReportAsSpreadsheetHelper ::
Bool -> ReportOpts -> MultiBalanceReport -> Bool -> ReportOpts -> MultiBalanceReport ->
@ -892,11 +888,6 @@ multiBalanceReportAsTable opts@ReportOpts{summary_only_, average_, row_total_, b
multiColumnTableInterRowBorder = NoLine multiColumnTableInterRowBorder = NoLine
multiColumnTableInterColumnBorder = if pretty_ opts then SingleLine else NoLine multiColumnTableInterColumnBorder = if pretty_ opts then SingleLine else NoLine
multiBalanceRowAsTextBuilders :: AmountFormat -> ReportOpts -> [DateSpan] -> PeriodicReportRow a MixedAmount -> [[WideBuilder]]
multiBalanceRowAsTextBuilders bopts ropts colspans =
rawTableContent .
multiBalanceRowAsCellBuilders bopts ropts colspans Value
multiBalanceRowAsCellBuilders :: multiBalanceRowAsCellBuilders ::
AmountFormat -> ReportOpts -> [DateSpan] -> AmountFormat -> ReportOpts -> [DateSpan] ->
RowClass -> PeriodicReportRow a MixedAmount -> RowClass -> PeriodicReportRow a MixedAmount ->
@ -949,10 +940,15 @@ multiBalanceRowAsCellBuilders bopts ReportOpts{..} colspans
multiBalanceRowAsText :: ReportOpts -> PeriodicReportRow a MixedAmount -> [[WideBuilder]] multiBalanceRowAsText :: ReportOpts -> PeriodicReportRow a MixedAmount -> [[WideBuilder]]
multiBalanceRowAsText opts = multiBalanceRowAsTextBuilders oneLineNoCostFmt{displayColour=color_ opts} opts [] multiBalanceRowAsText opts =
rawTableContent .
multiBalanceRowAsCellBuilders oneLineNoCostFmt{displayColour=color_ opts} opts [] Value
multiBalanceRowAsCsvText :: ReportOpts -> [DateSpan] -> PeriodicReportRow a MixedAmount -> [[T.Text]] multiBalanceRowAsCsvText :: ReportOpts -> [DateSpan] -> PeriodicReportRow a MixedAmount -> [[T.Text]]
multiBalanceRowAsCsvText opts colspans = fmap (fmap wbToText) . multiBalanceRowAsTextBuilders machineFmt opts colspans multiBalanceRowAsCsvText opts colspans =
map (map (wbToText . Ods.cellContent)) .
multiBalanceRowAsCellBuilders machineFmt opts colspans Value
-- Budget reports -- Budget reports