when adding, the balancing amount is a more useful default

This commit is contained in:
Simon Michael 2009-04-16 05:45:06 +00:00
parent 468955a563
commit 522a1f4c2a

View File

@ -112,7 +112,8 @@ getPostings bestmatchps enteredps = do
where Just ps = bestmatchps
defaultaccount = maybe Nothing (Just . paccount) bestmatch
validateaccount = Just $ \s -> not $ null s
defaultamount = maybe Nothing (Just . show . pamount) bestmatch
defaultamount | n==1 = maybe Nothing (Just . show . pamount) bestmatch -- previously used amount
| otherwise = Just $ show $ negate $ sum $ map pamount enteredps -- balancing amount
validateamount = Just $ \s ->
(null s && (not $ null enteredps)) ||
(isRight $ parse (someamount>>many spacenonewline>>eof) "" s)