lib: Remove unused AtDefault constructor for ValuationType.
This commit is contained in:
parent
46093b8de7
commit
e406cebcce
@ -342,7 +342,6 @@ postingApplyValuation priceoracle styles periodlast today p v =
|
||||
AtThen mc -> postingValueAtDate priceoracle styles mc (postingDate p) p
|
||||
AtEnd mc -> postingValueAtDate priceoracle styles mc periodlast p
|
||||
AtNow mc -> postingValueAtDate priceoracle styles mc today p
|
||||
AtDefault mc -> postingValueAtDate priceoracle styles mc periodlast p
|
||||
AtDate d mc -> postingValueAtDate priceoracle styles mc d p
|
||||
|
||||
-- | Convert this posting's amount to cost, and apply the appropriate amount styles.
|
||||
|
||||
@ -57,7 +57,6 @@ data ValuationType =
|
||||
| AtEnd (Maybe CommoditySymbol) -- ^ convert to default or given valuation commodity, using market prices at period end(s)
|
||||
| AtNow (Maybe CommoditySymbol) -- ^ convert to default or given valuation commodity, using current market prices
|
||||
| AtDate Day (Maybe CommoditySymbol) -- ^ convert to default or given valuation commodity, using market prices on some date
|
||||
| AtDefault (Maybe CommoditySymbol) -- ^ works like AtNow in single period reports, like AtEnd in multiperiod reports
|
||||
deriving (Show,Eq)
|
||||
|
||||
-- | A price oracle is a magic memoising function that efficiently
|
||||
@ -141,7 +140,6 @@ amountApplyValuation priceoracle styles periodlast today v a =
|
||||
-- amountValueAtDate priceoracle styles mc periodlast a -- posting date unknown, handle like AtEnd
|
||||
AtEnd mc -> amountValueAtDate priceoracle styles mc periodlast a
|
||||
AtNow mc -> amountValueAtDate priceoracle styles mc today a
|
||||
AtDefault mc -> amountValueAtDate priceoracle styles mc periodlast a
|
||||
AtDate d mc -> amountValueAtDate priceoracle styles mc d a
|
||||
|
||||
-- | Standard error message for a report not supporting --value=then.
|
||||
|
||||
@ -224,7 +224,6 @@ budgetReportAsText ropts@ReportOpts{..} budgetr =
|
||||
renderTable def{tableBorders=False,prettyTable=pretty_tables_}
|
||||
(alignCell TopLeft) (alignCell TopRight) (uncurry showcell) displayTableWithWidths
|
||||
where
|
||||
multiperiod = interval_ /= NoInterval
|
||||
title = printf "Budget performance in %s%s:"
|
||||
(showDateSpan $ periodicReportSpan budgetr)
|
||||
(case value_ of
|
||||
@ -232,9 +231,6 @@ budgetReportAsText ropts@ReportOpts{..} budgetr =
|
||||
Just (AtThen _mc) -> error' unsupportedValueThenError -- PARTIAL:
|
||||
Just (AtEnd _mc) -> ", valued at period ends"
|
||||
Just (AtNow _mc) -> ", current value"
|
||||
-- XXX duplicates the above
|
||||
Just (AtDefault _mc) | multiperiod -> ", valued at period ends"
|
||||
Just (AtDefault _mc) -> ", current value"
|
||||
Just (AtDate d _mc) -> ", valued at "++showDate d
|
||||
Nothing -> "")
|
||||
|
||||
|
||||
@ -360,7 +360,6 @@ accumValueAmounts ropts valuation colspans startbals acctchanges = -- PARTIAL:
|
||||
fixedValuationDate = case value_ ropts of
|
||||
Just (AtCost (Just _)) -> singleperiod
|
||||
Just (AtEnd _) -> singleperiod
|
||||
Just (AtDefault _) -> singleperiod
|
||||
_ -> True
|
||||
where singleperiod = interval_ ropts == NoInterval
|
||||
|
||||
|
||||
@ -128,8 +128,8 @@ valuationToggleCost _ = Just $ AtCost Nothing
|
||||
|
||||
-- | Basic toggling of -V, for hledger-ui.
|
||||
valuationToggleValue :: Maybe ValuationType -> Maybe ValuationType
|
||||
valuationToggleValue (Just (AtDefault _)) = Nothing
|
||||
valuationToggleValue _ = Just $ AtDefault Nothing
|
||||
valuationToggleValue (Just (AtEnd _)) = Nothing
|
||||
valuationToggleValue _ = Just $ AtEnd Nothing
|
||||
|
||||
-- | Set hierarchic account tree mode.
|
||||
setTree :: UIState -> UIState
|
||||
|
||||
@ -566,28 +566,22 @@ multiBalanceReportAsText ropts@ReportOpts{..} r =
|
||||
title = mtitle <> " in " <> showDateSpan (periodicReportSpan r) <> valuationdesc <> ":"
|
||||
|
||||
mtitle = case balancetype_ of
|
||||
PeriodChange | changingValuation -> "Period-end value changes"
|
||||
PeriodChange -> "Balance changes"
|
||||
CumulativeChange -> "Ending balances (cumulative)"
|
||||
HistoricalBalance -> "Ending balances (historical)"
|
||||
PeriodChange | changingValuation -> "Period-end value changes"
|
||||
PeriodChange -> "Balance changes"
|
||||
CumulativeChange -> "Ending balances (cumulative)"
|
||||
HistoricalBalance -> "Ending balances (historical)"
|
||||
valuationdesc = case value_ of
|
||||
Just (AtCost _mc) -> ", valued at cost"
|
||||
Just (AtThen _mc) -> error' unsupportedValueThenError -- TODO -- ", valued at period ends" -- handled like AtEnd for now -- PARTIAL:
|
||||
Just (AtEnd _mc) | changingValuation -> ""
|
||||
Just (AtEnd _mc) -> ", valued at period ends"
|
||||
Just (AtNow _mc) -> ", current value"
|
||||
-- XXX duplicates the above
|
||||
Just (AtDefault _mc) | changingValuation -> ""
|
||||
Just (AtDefault _mc) | multiperiod -> ", valued at period ends"
|
||||
Just (AtDefault _mc) -> ", current value"
|
||||
Just (AtDate d _mc) -> ", valued at "++showDate d
|
||||
Nothing -> ""
|
||||
|
||||
multiperiod = interval_ /= NoInterval
|
||||
changingValuation
|
||||
| PeriodChange <- balancetype_, Just (AtEnd _mc) <- value_ = multiperiod
|
||||
| PeriodChange <- balancetype_, Just (AtDefault _mc) <- value_ = multiperiod
|
||||
| otherwise = False
|
||||
changingValuation = case (balancetype_, value_) of
|
||||
(PeriodChange, Just (AtEnd _)) -> interval_ /= NoInterval
|
||||
_ -> False
|
||||
|
||||
-- | Build a 'Table' from a multi-column balance report.
|
||||
balanceReportAsTable :: ReportOpts -> MultiBalanceReport -> Table String String MixedAmount
|
||||
|
||||
@ -137,17 +137,12 @@ compoundBalanceCommand CompoundBalanceCommandSpec{..} opts@CliOpts{reportspec_=r
|
||||
Just (AtEnd _mc) | changingValuation -> ""
|
||||
Just (AtEnd _mc) -> ", valued at period ends"
|
||||
Just (AtNow _mc) -> ", current value"
|
||||
Just (AtDefault _mc) | changingValuation -> ""
|
||||
Just (AtDefault _mc) | multiperiod -> ", valued at period ends"
|
||||
Just (AtDefault _mc) -> ", current value"
|
||||
Just (AtDate today _mc) -> ", valued at "++showDate today
|
||||
Nothing -> ""
|
||||
|
||||
multiperiod = interval_ /= NoInterval
|
||||
changingValuation
|
||||
| PeriodChange <- balancetype_, Just (AtEnd _mc) <- value_ = multiperiod
|
||||
| PeriodChange <- balancetype_, Just (AtDefault _mc) <- value_ = multiperiod
|
||||
| otherwise = False
|
||||
changingValuation = case (balancetype_, value_) of
|
||||
(PeriodChange, Just (AtEnd _)) -> interval_ /= NoInterval
|
||||
_ -> False
|
||||
|
||||
-- make a CompoundBalanceReport.
|
||||
cbr' = compoundBalanceReport rspec{rsOpts=ropts'} j cbcqueries
|
||||
|
||||
Loading…
Reference in New Issue
Block a user