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

Add merge method on Shift class #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

doei
Copy link

@doei doei commented Jul 31, 2019

Hi,
This isn't much but I thought it could be handy.
Thanks for reviewing :)

@jackc
Copy link
Owner

jackc commented Jul 31, 2019

This is an interesting idea. But there are some edge cases that aren't covered -- and they might be difficult to resolve.

  1. Discontinuous shifts - What is the result of merging 7AM-9AM and 10AM-11AM? I would think it would need to be an invalid operation.
  2. Shifts crossing midnight - What is the result of merging 10PM-2AM and 1AM-3AM? I would expect 10PM-3AM but the current code would result in 1AM-10PM.
  3. Shifts that combine to over 24 hours - This problem overlaps with the previous. What does it mean to merge 1PM-5AM with 4AM-3PM? I would expect this to resolve to 1PM to 3PM the next day - a 26 hour shift. But the shift class can't represent that.

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

Successfully merging this pull request may close these issues.

2 participants