> However I never got an
> answer to them (maybe post them on the Q&A site? But these are
> architectural questions, not user questions…).
Agreed, architectural questions belong here.
> This summary table suggests that there are 4 intervals, however, my
> data-file only contains one (open) interval.
>
> I think a more honest display would be this:
>
> Wk Date Day ID Tags Start End Time Total
> W10 2017-03-08 Wed @1 6:00:00 12:00:00 6:00:00
> @1 13:00:00 0:00:00 11:00:00 17:00:00
> W10 2017-03-09 Thu @1 0:00:00 12:00:00 12:00:00
> @1 13:00:00 0:00:00 11:00:00 23:00:00
> W10 2017-03-10 Fri @1 0:00:00 12:00:00 12:00:00
> @1 13:00:00 - 0:56:14 12:56:14
>
> 52:56:14
>
> All intervals have the same id.
Yes, that would indeed make the id match reality. But that wasn’t the original intent. Here’s a scenario that illustrates what was *intended*, and clearly not properly implemented:
Given these exclusions:
Thursday = <9:00 >17:00
Friday = <9:00 >17:00
Assume this command, is run at noon on Thursday:
timew start tag1
Then obviously there is one open interval written to the data file. It is intended that open intervals are just a start time, and exclusions are used to calculate total tracked time. When an interval is closed, that one entry gets modified, and turns into N closed intervals, where N >= 1. It the interval is closed on Friday at noon, I expect these intervals to be stored:
20170309T120000Z - 20170309T170000Z # tag1
20170310T090000Z - 20170310T120000Z # tag1
In this situation, there is @1 and @2. No problem.
Now in the other case, suppose the interval remains open at noon on Friday, which means one stored entry. When the summary command (or export, or anything else) is run, it is intended that two intervals are shown, the first, @2 being closed, and the second, @1 being still open, like this:
20170309T120000Z - 20170309T170000Z # tag1
20170310T090000Z - # tag1
To say it another way, open intervals are represented by one entry in the data file, and N simulated intervals for the purposes of reports, addressable in the usual way, @1, @2. If a simulated interval is modified in some way, then the simulated intervals, after adjustment, should be written to the data file. In this example, a closed followed by an open interval are written.
Saying it yet another way: Open intervals span exclusions. Reports are always shown a mix of real intervals, and simulated intervals if there are any open intervals at the time.
> Sidenote: timew delete @1 still does not work, but you are no longer
> mislead to think that there are 4 intervals in the database.
>
> Another approach would be to immediately write completed/closed
> intervals into the database, i.e. the start command above would not
> write one open interval, 3 closed and one open.
Yes, this is the intended behavior. Something is clearly not working, otherwise the bug wouldn’t exist. I believe the simulated intervals are correctly created (otherwise “summary” would be wrong), but the functions that modify data are where the problem lies. I must have simply not tested this, and assumed I was finished when all the tests passed.
> Comments welcome.
>
> Regards,
> Thomas
>
>
> PS: And here is the old email with some other details and questions that
> came up with TI-58:
I’m going to answer these, although it is be covered by the above. I’m answering for additional clarity.
> # Is "timew delete @1" equal to "timew cancel”?
No, but it’s close. If @1 is open, then @2 (etc) may be simulated, and will need to be written. But the overall result in both cases is that @1 goes away.
> Imagine defined daily exclusions from 12:00-13:00
> The command "timew start today" will write 1 interval into the database,
> but display two in "timew export" and "timew summary":
>
> Wk Date Day ID Tags Start End Time Total
> W10 2017-03-06 Mon @2 foo 0:00:00 12:00:00 12:00:00
> @1 foo 13:00:00 - 7:13:58 19:13:58
>
> 19:13:58
>
> "timew cancel" would remove the open interval, i.e. remove both, "timew
> delete @1" would (be expected to) remove the last (open) interval. Or not?
Not both. @1 would be removed, @2 is simulated, and would need to replace the written open interval.
> # The delete command serializes the interval to be deleted and searches
> for it in the respective datafile. This depends on defined exclusions
>
> - Defined exclusion 12:00 - 13:00
> - Create open interval: timew start today foo
> => Entry in datafile: inc 20170305T230000Z # foo
> => Result of "timew export":
> [
> {"start":"20170305T230000Z","end":"20170306T110000Z","tags":["foo"]},
> {"start":"20170306T120000Z","tags":["foo"]}
> ]
>
> - The delete command would search for "inc 20170306T120000Z # foo"
> which does not exist in the datafile
Correct. This is the bug.
> My proposed fix for TI-58 would be to expand the exclusion when the
> interval is started and write them to the database. This would also
> alter (fix?) the following scenario (performed at some point in the
> afternoon):
Close. Described above.
> timew config rc.exclusions.<current weekday>=12:00-13:00*
> timew start today
> timew summary
>
> Wk Date Day ID Tags Start End Time Total
> W10 2017-03-06 Mon @2 0:00:00 12:00:00 12:00:00
> @1 13:00:00 - 7:33:30 19:33:30
>
> 19:33:30
>
> timew config rc.exclusions.<current weekday>=11:00-14:00*
> timew summary
>
> Wk Date Day ID Tags Start End Time Total
> W10 2017-03-06 Mon @2 0:00:00 11:00:00 11:00:00
> @1 14:00:00 - 6:34:38 17:34:38
>
> 17:34:38
>
> The interval is altered by the change in the configuration. Is this
> expected/desired? If yes, you cannot (currently!) change the exclusion
> for the current weekday without possibly altering the current
> timetracking…
The interval would be altered by config changes only if the interval is open. Once closed, it’s fixed.
Hope this clarifies and doesn’t instead add another misty layer.
P