From c5d8ece080e72c16f351ef6ebf4e5545fee655b6 Mon Sep 17 00:00:00 2001 From: Dmitry Astapov Date: Sun, 19 Jan 2025 15:27:31 +0000 Subject: [PATCH] ;roi: optimize "one period per report interval" case a bit --- hledger/Hledger/Cli/Commands/Roi.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hledger/Hledger/Cli/Commands/Roi.hs b/hledger/Hledger/Cli/Commands/Roi.hs index caeb95903fd..06974d235a2 100644 --- a/hledger/Hledger/Cli/Commands/Roi.hs +++ b/hledger/Hledger/Cli/Commands/Roi.hs @@ -154,7 +154,9 @@ roi CliOpts{rawopts_=rawopts, reportspec_=rspec@ReportSpec{_rsReportOpts=ReportO , T.pack $ printf "%0.2f%%" $ smallIsZero annualizedTwr ] periodRows <- forM spans processSpan - totalRow <- processSpan fullPeriod + totalRow <- case periodRows of + [singleRow] -> return singleRow + _ -> processSpan fullPeriod let rowTitles = Tab.Group Tab.NoLine (map (Header . T.pack . show) (take (length periodRows) [1..]))