Closed schafdog closed 6 months ago
Perhaps an option to sort the file by date. That would fix both issues.
Yes, I see the problem. The code always just appends new lines to the file.
I did sort your data file manually. Seems to have fixed the current issue. I was afraid that it would mess with commented-out lines, but those seem to be in the right place anyway. Not quite sure how unix sort figured that out.
A better would be to change the logic that edits a line, make sure it writes the new line in its proper place.
At least a partial fix: When editing a record, it is now placed in the right spot in the file.
New records are still appended to the file, so it is possible to get data out of order. But editing such a line should fix it. I don't think I want to rewrite the whole data file on every insert, most of the time appending is just fine.
Now checking the time stamp of any new record, and if that is before the last seen time stamp, do the inserting update instead of appending. Now it should not be possible to get data out of order.
Added some beer from friday today. Changed the dates to friday They are shown correctly in the graph but is added today's daysum.
I think the open issue to use a hash will fix the sum.
They are also still shown after Saturday, I guess in the order that they were added to the file.