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:
		
							parent
							
								
									72c39470d6
								
							
						
					
					
						commit
						4ceda8f985
					
				@ -90,12 +90,15 @@ parse _ = parseAndFinaliseJournal timeclockfilep
 | 
				
			|||||||
timeclockfilep :: ErroringJournalParser ParsedJournal
 | 
					timeclockfilep :: ErroringJournalParser ParsedJournal
 | 
				
			||||||
timeclockfilep = do many timeclockitemp
 | 
					timeclockfilep = do many timeclockitemp
 | 
				
			||||||
                    eof
 | 
					                    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.
 | 
					                    -- 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,
 | 
					                    -- Doing this here rather than in journalFinalise means timeclock sessions can't span file boundaries,
 | 
				
			||||||
                    -- but it simplifies code above.
 | 
					                    -- but it simplifies code above.
 | 
				
			||||||
                    now <- liftIO getCurrentLocalTime
 | 
					                    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'
 | 
					                    return j'
 | 
				
			||||||
    where
 | 
					    where
 | 
				
			||||||
      -- As all ledger line types can be distinguished by the first
 | 
					      -- As all ledger line types can be distinguished by the first
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user