timeclock: fix order of transaction indexes #394

Timeclock transaction ids now count up rather than down.

Also, remove old code for appending timeclock transactions to journal transactions,
a holdover from the days when both were allowed in one file.
This commit is contained in:
Simon Michael 2016-08-14 14:50:03 -07:00
parent 72c39470d6
commit 4ceda8f985

View File

@ -90,12 +90,15 @@ parse _ = parseAndFinaliseJournal timeclockfilep
timeclockfilep :: ErroringJournalParser ParsedJournal
timeclockfilep = do many timeclockitemp
eof
j@Journal{jtxns=ts, jparsetimeclockentries=es} <- get
j@Journal{jparsetimeclockentries=es} <- get
-- Convert timeclock entries in this journal to transactions, closing any unfinished sessions.
-- Doing this here rather than in journalFinalise means timeclock sessions can't span file boundaries,
-- but it simplifies code above.
now <- liftIO getCurrentLocalTime
let j' = j{jtxns = ts ++ timeclockEntriesToTransactions now (reverse es), jparsetimeclockentries = []}
-- entries have been parsed in reverse order. timeclockEntriesToTransactions
-- expects them to be in normal order, then we must reverse again since
-- journalFinalise expects them in reverse order
let j' = j{jtxns = reverse $ timeclockEntriesToTransactions now $ reverse es, jparsetimeclockentries = []}
return j'
where
-- As all ledger line types can be distinguished by the first