simplify, remove dead code
This commit is contained in:
		
							parent
							
								
									648887b36f
								
							
						
					
					
						commit
						ebcf695240
					
				| @ -45,7 +45,6 @@ import Ledger.Commodity | ||||
| 
 | ||||
| 
 | ||||
| instance Show Amount where show = showAmount | ||||
| -- instance Show MixedAmount where show = showMixedAmount | ||||
| 
 | ||||
| instance Num Amount where | ||||
|     abs (Amount c q) = Amount c (abs q) | ||||
| @ -98,11 +97,11 @@ punctuatethousands s = | ||||
|       triples [] = [] | ||||
|       triples l  = [take 3 l] ++ (triples $ drop 3 l) | ||||
| 
 | ||||
| -- | Get the string representation of an amount, rounded, or showing just "0" if it's zero. | ||||
| showAmountOrZero :: Amount -> String | ||||
| showAmountOrZero a | ||||
|     | isZeroAmount a = "0" | ||||
|     | otherwise = showAmount a | ||||
| -- -- | Get the string representation of an amount, rounded, or showing just "0" if it's zero. | ||||
| -- showAmountOrZero :: Amount -> String | ||||
| -- showAmountOrZero a | ||||
| --     | isZeroAmount a = "0" | ||||
| --     | otherwise = showAmount a | ||||
| 
 | ||||
| -- | Get the string representation of an amount, rounded, or showing just "0" if it's zero. | ||||
| showMixedAmountOrZero :: MixedAmount -> String | ||||
|  | ||||
| @ -60,10 +60,8 @@ showEntry e = | ||||
| showDate = printf "%-10s" | ||||
| 
 | ||||
| isEntryBalanced :: Entry -> Bool | ||||
| isEntryBalanced (Entry {etransactions=ts}) = isZeroMixedAmount sum | ||||
|     where | ||||
|       sum = sumRawTransactions realts | ||||
|       realts = filter isReal ts | ||||
| isEntryBalanced (Entry {etransactions=ts}) =  | ||||
|     isZeroMixedAmount $ sumMixedAmounts $ map tamount $ filter isReal ts | ||||
| 
 | ||||
| -- | Fill in a missing balance in this entry, if we have enough | ||||
| -- information to do that. Excluding virtual transactions, there should be | ||||
| @ -76,10 +74,7 @@ balanceEntry e@(Entry{etransactions=ts}) = e{etransactions=ts'} | ||||
|               0 -> ts | ||||
|               1 -> map balance ts | ||||
|               otherwise -> error $ "could not balance this entry, too many missing amounts:\n" ++ show e | ||||
|       otherstotal = sumRawTransactions withamounts | ||||
| --       simpleotherstotal | ||||
| --           | length otherstotal == 1 = head otherstotal | ||||
| --           | otherwise = error $ "sorry, can't balance a mixed-commodity entry yet:\n" ++ show e | ||||
|       otherstotal = sumMixedAmounts $ map tamount withamounts | ||||
|       balance t | ||||
|           | isReal t && not (hasAmount t) = t{tamount = -otherstotal} | ||||
|           | otherwise = t | ||||
|  | ||||
| @ -31,6 +31,3 @@ isReal t = rttype t == RegularTransaction | ||||
| 
 | ||||
| hasAmount :: RawTransaction -> Bool | ||||
| hasAmount = (/= autoamt) . tamount | ||||
| 
 | ||||
| sumRawTransactions :: [RawTransaction] -> MixedAmount | ||||
| sumRawTransactions = normaliseMixedAmount . sumMixedAmounts . map tamount | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user