don't show trailing spaces on amountless postings
This commit is contained in:
parent
18e9f826d6
commit
3e6943e5f6
@ -71,14 +71,13 @@ showLedgerTransaction' elide t =
|
|||||||
| otherwise = map showposting ps
|
| otherwise = map showposting ps
|
||||||
where
|
where
|
||||||
showposting p = showacct p ++ " " ++ (showamount $ pamount p) ++ (showcomment $ pcomment p)
|
showposting p = showacct p ++ " " ++ (showamount $ pamount p) ++ (showcomment $ pcomment p)
|
||||||
showpostingnoamt p = showacct p ++ " " ++ (showcomment $ pcomment p)
|
showpostingnoamt p = rstrip $ showacct p ++ " " ++ (showcomment $ pcomment p)
|
||||||
showacct p = " " ++ showstatus p ++ (showaccountname $ paccount p)
|
showacct p = " " ++ showstatus p ++ (showaccountname $ paccount p)
|
||||||
showamount = printf "%12s" . showMixedAmount
|
showamount = printf "%12s" . showMixedAmount
|
||||||
showaccountname s = printf "%-34s" s
|
showaccountname s = printf "%-34s" s
|
||||||
showcomment s = if (length s) > 0 then " ; "++s else ""
|
showcomment s = if (length s) > 0 then " ; "++s else ""
|
||||||
showstatus p = case pstatus p of
|
showstatus p = if pstatus p then "* " else ""
|
||||||
True -> "* "
|
rstrip = reverse . dropWhile (== ' ') . reverse
|
||||||
False -> ""
|
|
||||||
|
|
||||||
isLedgerTransactionBalanced :: LedgerTransaction -> Bool
|
isLedgerTransactionBalanced :: LedgerTransaction -> Bool
|
||||||
isLedgerTransactionBalanced (LedgerTransaction {ltpostings=ps}) =
|
isLedgerTransactionBalanced (LedgerTransaction {ltpostings=ps}) =
|
||||||
|
|||||||
7
Tests.hs
7
Tests.hs
@ -748,6 +748,9 @@ tests = [
|
|||||||
|
|
||||||
,"show hours" ~: show (hours 1) ~?= "1.0h"
|
,"show hours" ~: show (hours 1) ~?= "1.0h"
|
||||||
|
|
||||||
|
,"showLedgerTransaction" ~: do
|
||||||
|
showLedgerTransaction entry1 `is` entry1_str
|
||||||
|
|
||||||
,"smart dates" ~: do
|
,"smart dates" ~: do
|
||||||
let str `gives` datestr = fixSmartDateStr (parsedate "2008/11/26") str `is` datestr
|
let str `gives` datestr = fixSmartDateStr (parsedate "2008/11/26") str `is` datestr
|
||||||
"1999-12-02" `gives` "1999/12/02"
|
"1999-12-02" `gives` "1999/12/02"
|
||||||
@ -915,8 +918,8 @@ rawposting1 = Posting False "expenses:food:dining" (Mixed [dollars 10]) "" Regul
|
|||||||
|
|
||||||
entry1_str = unlines
|
entry1_str = unlines
|
||||||
["2007/01/28 coopportunity"
|
["2007/01/28 coopportunity"
|
||||||
," expenses:food:groceries $47.18"
|
," expenses:food:groceries $47.18"
|
||||||
," assets:checking"
|
," assets:checking"
|
||||||
,""
|
,""
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user