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:
		
							parent
							
								
									cdec0f9382
								
							
						
					
					
						commit
						46093b8de7
					
				| @ -284,7 +284,9 @@ budgetReportAsText ropts@ReportOpts{..} budgetr = | |||||||
|         _   -> -- trace (pshow $ (maybecost actual, maybecost budget))  -- debug missing percentage |         _   -> -- trace (pshow $ (maybecost actual, maybecost budget))  -- debug missing percentage | ||||||
|                Nothing |                Nothing | ||||||
|       where |       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) |     maybetranspose | transpose_ = \(Table rh ch vals) -> Table ch rh (transpose vals) | ||||||
|                    | otherwise  = id |                    | otherwise  = id | ||||||
|  | |||||||
| @ -39,8 +39,6 @@ module Hledger.Reports.ReportOptions ( | |||||||
|   reportPeriodOrJournalStart, |   reportPeriodOrJournalStart, | ||||||
|   reportPeriodLastDay, |   reportPeriodLastDay, | ||||||
|   reportPeriodOrJournalLastDay, |   reportPeriodOrJournalLastDay, | ||||||
|   valuationTypeIsCost, |  | ||||||
|   valuationTypeIsDefaultValue, |  | ||||||
| ) | ) | ||||||
| where | where | ||||||
| 
 | 
 | ||||||
| @ -429,18 +427,6 @@ valuationTypeFromRawOpts = lastMay . collectopts valuationfromrawopt | |||||||
|                    "" -> Nothing |                    "" -> Nothing | ||||||
|                    c  -> Just $ T.pack c |                    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. | -- | Select the Transaction date accessor based on --date2. | ||||||
| transactionDateFn :: ReportOpts -> (Transaction -> Day) | transactionDateFn :: ReportOpts -> (Transaction -> Day) | ||||||
| transactionDateFn ReportOpts{..} = if date2_ then transactionDate2 else tdate | transactionDateFn ReportOpts{..} = if date2_ then transactionDate2 else tdate | ||||||
|  | |||||||
| @ -81,10 +81,8 @@ tsDraw UIState{aopts=UIOpts{cliopts_=copts@CliOpts{reportspec_=rspec@ReportSpec{ | |||||||
| 
 | 
 | ||||||
|       render $ defaultLayout toplabel bottomlabel $ str $ |       render $ defaultLayout toplabel bottomlabel $ str $ | ||||||
|         showTransactionOneLineAmounts $ |         showTransactionOneLineAmounts $ | ||||||
|         (if valuationTypeIsCost ropts then transactionToCost (journalCommodityStyles j) else id) $ |         maybe t (transactionApplyValuation prices styles periodlast (rsToday rspec) t) $ value_ ropts | ||||||
|         (if valuationTypeIsDefaultValue ropts then (\t -> transactionApplyValuation prices styles periodlast (rsToday rspec) t (AtDefault Nothing)) else id) $ |  | ||||||
|         -- (if real_ ropts then filterTransactionPostings (Real True) else id) -- filter postings by --real |         -- (if real_ ropts then filterTransactionPostings (Real True) else id) -- filter postings by --real | ||||||
|         t |  | ||||||
|       where |       where | ||||||
|         toplabel = |         toplabel = | ||||||
|           str "Transaction " |           str "Transaction " | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user