Skip to content

Commit

Permalink
timelog: show hours with 2 decimal places, not 1
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichael committed Feb 27, 2015
1 parent 099a1de commit 592ae9a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doc/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -736,10 +736,10 @@ and creates a virtual transaction (or several - one per day) with the
appropriate amount of hours. From the time log above, hledger print gives:

2009/03/31 * 22:21-23:59
(projects:A) 1.6h
(projects:A) 1.64h

2009/04/01 * 00:00-02:00
(projects:A) 2.0h
(projects:A) 2.01h

Here is a
[sample.timelog](https://raw.github.com/simonmichael/hledger/master/data/sample.timelog) to
Expand Down
2 changes: 1 addition & 1 deletion hledger-lib/Hledger/Data/Amount.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ missingamt = amount{acommodity="AUTO"}
-- Handy amount constructors for tests.
-- usd/eur/gbp round their argument to a whole number of pennies/cents.
num n = amount{acommodity="", aquantity=n}
hrs n = amount{acommodity="h", aquantity=n, astyle=amountstyle{asprecision=2, ascommodityside=R}}
usd n = amount{acommodity="$", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}}
eur n = amount{acommodity="", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}}
gbp n = amount{acommodity="£", aquantity=roundTo 2 n, astyle=amountstyle{asprecision=2}}
hrs n = amount{acommodity="h", aquantity=roundTo 1 n, astyle=amountstyle{asprecision=1, ascommodityside=R}}
amt `at` priceamt = amt{aprice=UnitPrice priceamt}
amt @@ priceamt = amt{aprice=TotalPrice priceamt}

Expand Down
4 changes: 2 additions & 2 deletions hledger-lib/Hledger/Data/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ tests_showTransactionUnelided = [
"2012/05/14=2012/05/15 (code) desc ; tcomment1",
" ; tcomment2",
" $1.00",
" * a 2.0h",
" * a 2.00h",
" ; pcomment2",
""
]
Expand Down Expand Up @@ -203,7 +203,7 @@ tests_postingAsLines = [
}
`gives` [
" $1.00",
" * a 2.0h ; pcomment1",
" * a 2.00h ; pcomment1",
" ; pcomment2",
" ; tag3: val3 "
]
Expand Down
2 changes: 1 addition & 1 deletion hledger/Hledger/Cli.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ tests_Hledger_Cli = TestList

,"show dollars" ~: showAmount (usd 1) ~?= "$1.00"

,"show hours" ~: showAmount (hrs 1) ~?= "1.0h"
,"show hours" ~: showAmount (hrs 1) ~?= "1.00h"

]

Expand Down
2 changes: 1 addition & 1 deletion tests/timelog/timelog.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ o 2009/1/1 09:00:00

>>>
2009/01/01 * 08:00-09:00
(something) 1.0h
(something) 1.00h

>>>2
>>>= 0
Expand Down

0 comments on commit 592ae9a

Please sign in to comment.