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