-
-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timeclock: better support for collecting data in multiple files ? #2142
Comments
Could you help clarify the following?
However, I've logged all my work in 2023 with one timeclock file per week (for example
I can then run |
Yup, I meant with "Clockins/clockouts split across files". I think you aren't clocking in in one file and clocking out in another. As long as you keep clockins/outs nicely paired in each file, including them works fine as you say. |
By "merge them first" there I meant the manual merge process, like |
OK so a problem scenario would be something like starting a task at 23:00 on Sunday night and finishing it at 01:00 on Monday morning - have I got that right? If we're being strict, then the "clock in" would be at the end of one week file and the "clock out" would be in the second. Using the following files:
Running: hledger -f year.journal bal Gives:
Would this issue, if fixed, solve this problem? |
Yes, making this more flexible (eg, ignoring "orphan" clockouts) would fix the "2. Clockins/clockouts split across files" problem. |
Could you help clarify some of that planned flexible behaviour for multiple files? So, given that we have the following 3 timeclock files:
And given there is a basic journal that includes all the timeclock files:
Then when we ask
Will we receive:
Or
Thanks 🙏🏻 |
It needs some design, indeed. A bit of research:
|
So following the [imagined] Ledger design, I'd expect the second output - the first, generic, o closes the most recent i (github), and the second o closes the next most recent i (reading). |
I did some testing and updated the notes above. Ledger, like hledger, does not allow an orphaned o in a file of its own. But if you combine the above examples into one file, I confirmed that Ledger calculates 6h for reading and 2h for github. |
So a question to think about, when considering multiple input files, possibly with multiple formats: It could be, eg: a. Check that each i or o record has valid syntax |
Though that b. (allowing orphan o's in individual files, but disallowing it in the combined timeclock data) feels both tricky to implement, and likely to bring the kind of data-order-dependent fragility we prefer to avoid. So if anything, I would be more inclined to just ignore orphaned o's always. And this would sacrifice some error checking. In exchange, it would help support the "messy timeclock files" use case, where i's and o's may appear in any of several files. It wouldn't be sufficient though; it seems likely that "messy" timeclock files would also fairly easily break the date order requirement. I don't have an example, but I'm imagining hopping back and forth between devices, clocking in and out like a madman (perhaps by automated tool), and/or mixing up the order of input files when reporting. So this use case would probably require flexibility in date order, and that would need some design also. It's a good time to think again, how important and desirable is this use case ? Note that @nobodyinperson is implementing his own solution based on git-annex. |
If there is currently a requirement to have all |
This came up in a mastodon/matrix chat:
nobodyinperson:
sm
The multiple sessions limitation is noted as #2141. This issue covers two more problems with logging hledger timeclock data on multiple devices:
1. Merging changes from multiple places, with two sub-cases:
a. Not using version control, or only one file using version control
In this case you can merge manually by sorting all files' content into the home file [and committing that].
b. All files using version control, and a wish to preserve and merge the commit histories from all devices
In this case, pulling from the other repos creates ugly merge conflicts (with git at least; not tested with darcs or pijul).
2. Clockins/clockouts split across files
hledger won't read the multiple timeclock files unless you merge them first, because it currently doesn't allow a clockout in file B for a clockin in file A.
The text was updated successfully, but these errors were encountered: