Skip to content
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

fix overlapping events when editing new period #315

Open
leo-b opened this issue Jan 11, 2025 · 0 comments
Open

fix overlapping events when editing new period #315

leo-b opened this issue Jan 11, 2025 · 0 comments

Comments

@leo-b
Copy link

leo-b commented Jan 11, 2025

Hi!

I am using the Edit Events -> New Period feature to subsequently add periods inside existing working days.

Unfortunately this doesn't produce the expected results if the newly inserted period overlaps with existing tasks.
IN and OUT events of existing overlapping tasks are simply not modified.
This is a bug because it corrupts the data:

  • If a new period with a different Task-id is inserted and the OUT event of the previously existing task is inside that period, it will erroneously end the new period because OUT events have no task-id and the old OUT it will be interpreted as the end of the new task. Furthermore the timespan following the old OUT event will be without any assigned task.
  • If a new period with a different Task-id is inserted and the IN event of the previously existing task is inside that period, it will also end the newly inserted period and start the old task (possibly with a different task-id). The OUT event of the new period will possibly end any other existing task.

The proposed correct behavior (when processing existing events inside the new period in chronological order) would be:

  • If an existing OUT event is inside the new period:

    • if the OUT event ends a task with a different task-id, the existing event should be removed. Since there are no overlapping tasks in trackworktime, ther new IN event will autoatically end the previous task.
    • if the OUT event ends a task with the same task-id, the existing OUT event and the new IN event should be omitted, because the newly added period extends the existing task. (Existing hints attached to the previously existing task will be kept because they are stored with the old IN event. Maybe hints added to the new period should be appended to an existing hint?)
  • If an existing IN event is inside the new period:

    • If the corresponding OUT event is also inside the new period: remove both events. (The whole existing task was inside the new period and trackworktime doesn't allow overlapping tasks, so it is completely overwritten.)
    • If the corresponding OUT event is outside the new period:
      • If the new task-id matches the old task: The new period extends the existing task. Remove the existing IN event and omit the existing OUT event. (The OUT event of the existing task will automatically end the extended task.) (Maybe existing hints stored withe the removed IN event should be appeded to any new hints?)
      • If the new task-id is different from the existing task: The new period cuts some time off the existing task. Modify the existing IN event to the end of the newly inserted period. Omit the OUT event of the new period, since the moved IN event will already end the new task.

Maybe a (configurable) warning should be shown if editing a new period modifies existing tasks.

Cheers,
--leo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant