jackc / jackc/tod

Add union and intersect methods to Tod::Shift

Open
#26 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
447
Forks
56
PR merge metrics
No merged PRs in 30d

Description

Use cases:
- `union` for when you have multiple shifts within the same time period (e.g. different people on a team) and want to find the effective shift when somebody is working.
- `intersect` for a similar scenario, but you want to find when somebody is _not_ working.

It's possible that this might be problematic to implement in a general sense because it could be nondeterministic with shifts that go into the next day. I'm going to be writing this anyway as we have the requirement to do this within a day, but would be happy to have a go at writing a more general approach if you're interested in having it in the library?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Tod::Shift implementation and determine how existing shift boundaries and next-day shifts are represented. Define the within-a-day behavior for union and intersect, including how shifts crossing midnight are handled, then add coverage showing the stated working and non-working cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.