imp:timeclock: improve overlapping sessions error [#2417]
This commit is contained in:
parent
04e6c140c0
commit
8bd9d92981
@ -112,9 +112,14 @@ pairClockEntries (entry : rest) actives sessions
|
||||
inentries = case filter ((== tlaccount entry) . tlaccount) actives of
|
||||
[] -> entry : actives
|
||||
activesinthisacct -> error' $ T.unpack $ makeTimeClockErrorExcerpt entry $ T.unlines $ [
|
||||
"Simultaneous sessions with the same account name are not supported."
|
||||
,"This clockin overlaps with:"
|
||||
] <> map (flip makeTimeClockErrorExcerpt "") activesinthisacct
|
||||
""
|
||||
,"overlaps with session beginning at:"
|
||||
,""
|
||||
]
|
||||
<> map (flip makeTimeClockErrorExcerpt "") activesinthisacct
|
||||
<> [
|
||||
"Overlapping sessions with the same account name are not supported."
|
||||
]
|
||||
-- XXX better to show full session(s)
|
||||
-- <> map T.show (filter ((`elem` activesinthisacct).in') sessions)
|
||||
|
||||
@ -123,7 +128,6 @@ makeTimeClockErrorExcerpt e@TimeclockEntry{tlsourcepos=pos} msg = T.unlines [
|
||||
T.pack (sourcePosPretty pos) <> ":"
|
||||
,l <> " | " <> T.show e
|
||||
-- ,T.replicate (T.length l) " " <> " |" -- <> T.replicate c " " <> "^")
|
||||
,""
|
||||
] <> msg
|
||||
where
|
||||
l = T.show $ unPos $ sourceLine $ tlsourcepos e
|
||||
|
||||
@ -2,8 +2,12 @@ $$$ hledger check -f tcorderedactions.timeclock
|
||||
>>>2 /Error: .*tcorderedactions.timeclock:8:1:
|
||||
8 \| i 2022-01-01 00:01:00 a
|
||||
|
||||
Simultaneous sessions with the same account name are not supported.
|
||||
This clockin overlaps with:
|
||||
overlaps with session beginning at:
|
||||
|
||||
.*
|
||||
7 \| i 2022-01-01 00:00:00 a
|
||||
|
||||
Overlapping sessions with the same account name are not supported.
|
||||
/
|
||||
>>>= 1
|
||||
|
||||
|
||||
@ -200,7 +200,7 @@ i 2024-01-01 14:00:00 a
|
||||
o 2024-01-01 15:00:00
|
||||
|
||||
$ hledger -f timeclock:- print
|
||||
>2 /Simultaneous sessions with the same account name are not supported./
|
||||
>2 /Overlapping sessions with the same account name are not supported./
|
||||
>=!0
|
||||
|
||||
# ** OLD:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user