lib,ui: For hledger-ui, do valuation for all valuation types, not just

AtCost and AtDefault.

Remove unused valuationTypeIs* functions.
This commit is contained in:
Stephen Morgan 2020-12-17 17:26:22 +11:00 committed by Simon Michael
parent cdec0f9382
commit 46093b8de7
3 changed files with 4 additions and 18 deletions

View File

@ -284,7 +284,9 @@ budgetReportAsText ropts@ReportOpts{..} budgetr =
_ -> -- trace (pshow $ (maybecost actual, maybecost budget)) -- debug missing percentage
Nothing
where
maybecost = if valuationTypeIsCost ropts then mixedAmountCost else id
maybecost = case value_ of
Just (AtCost _) -> mixedAmountCost
_ -> id
maybetranspose | transpose_ = \(Table rh ch vals) -> Table ch rh (transpose vals)
| otherwise = id

View File

@ -39,8 +39,6 @@ module Hledger.Reports.ReportOptions (
reportPeriodOrJournalStart,
reportPeriodLastDay,
reportPeriodOrJournalLastDay,
valuationTypeIsCost,
valuationTypeIsDefaultValue,
)
where
@ -429,18 +427,6 @@ valuationTypeFromRawOpts = lastMay . collectopts valuationfromrawopt
"" -> Nothing
c -> Just $ T.pack c
valuationTypeIsCost :: ReportOpts -> Bool
valuationTypeIsCost ropts =
case value_ ropts of
Just (AtCost _) -> True
_ -> False
valuationTypeIsDefaultValue :: ReportOpts -> Bool
valuationTypeIsDefaultValue ropts =
case value_ ropts of
Just (AtDefault _) -> True
_ -> False
-- | Select the Transaction date accessor based on --date2.
transactionDateFn :: ReportOpts -> (Transaction -> Day)
transactionDateFn ReportOpts{..} = if date2_ then transactionDate2 else tdate

View File

@ -81,10 +81,8 @@ tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{
render $ defaultLayout toplabel bottomlabel $ str $
showTransactionOneLineAmounts $
(if valuationTypeIsCost ropts then transactionToCost (journalCommodityStyles j) else id) $
(if valuationTypeIsDefaultValue ropts then (\t -> transactionApplyValuation prices styles periodlast (rsToday rspec) t (AtDefault Nothing)) else id) $
maybe t (transactionApplyValuation prices styles periodlast (rsToday rspec) t) $ value_ ropts
-- (if real_ ropts then filterTransactionPostings (Real True) else id) -- filter postings by --real
t
where
toplabel =
str "Transaction "