parsing: timelog entries now generate balanced transactions, using virtual postings
This commit is contained in:
parent
be30aac3f5
commit
65cf381dbc
@ -87,9 +87,7 @@ entryFromTimeLogInOut i o
|
||||
hrs = elapsedSeconds (toutc otime) (toutc itime) / 3600 where toutc = localTimeToUTC utc
|
||||
amount = Mixed [hours hrs]
|
||||
ps = [Posting{pstatus=False,paccount=acctname,pamount=amount,
|
||||
pcomment="",ptype=RegularPosting,ptransaction=Just t}
|
||||
--,Posting "assets:time" (-amount) "" RegularPosting
|
||||
]
|
||||
pcomment="",ptype=VirtualPosting,ptransaction=Just t}]
|
||||
|
||||
tests_TimeLog = TestList [
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@ i 2010/1/1 09:00:00 a:b
|
||||
o 2010/1/1 09:03:00
|
||||
>>>=0
|
||||
# incidentally this didn't trigger it.. go figure
|
||||
bin/hledger -f - balance
|
||||
<<<
|
||||
i 2010/1/1 09:00:00 a:b
|
||||
o 2010/1/1 09:02:00
|
||||
>>>=0
|
||||
#bin/hledger -f - balance
|
||||
#<<<
|
||||
#i 2010/1/1 09:00:00 a:b
|
||||
#o 2010/1/1 09:02:00
|
||||
#>>>=0
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
# a timelog session is parsed as a similarly-named transaction with one virtual posting
|
||||
bin/hledger -f - print
|
||||
<<<
|
||||
i 2009/1/1 08:00:00 x
|
||||
i 2009/1/1 08:00:00 something
|
||||
o 2009/1/1 09:00:00
|
||||
|
||||
>>>
|
||||
2009/01/01 * 08:00-09:00
|
||||
x 1.0h
|
||||
(something) 1.0h
|
||||
|
||||
>>>2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user