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

Conflicting neighbour events when they are not #11

Open
aliowacom opened this issue Dec 8, 2021 · 1 comment
Open

Conflicting neighbour events when they are not #11

aliowacom opened this issue Dec 8, 2021 · 1 comment

Comments

@aliowacom
Copy link

Recently I've been testing package and found out that there's a bug with conflicting events.

All events within resource suddenly become conflicting and are rendered very narrowly.
Steps to reproduce:

  1. create non conflicting events within one resource
  2. add last non conflicting event with ends_at 00:00
   public function resources()
    {
        return collect([
            ['id' => '1', 'title' => 'Meal day'],
        ]);
    }
    
    public function events()
    {
        return collect([
            [
                'id' => 1,
                'title' => 'Breakfast',
                'starts_at' => Carbon::today()->setTime(8, 0),
                'ends_at' => Carbon::today()->setTime(9, 0),
                'resource_id' => '1',
            ],
            [
                'id' => 2,
                'title' => 'Lunch',
                'starts_at' => Carbon::today()->setTime(12, 0),
                'ends_at' => Carbon::today()->setTime(14, 0),
                'resource_id' => '1',
            ],
            [
                'id' => 3,
                'title' => 'Dinner',
                'starts_at' => Carbon::today()->setTime(18, 0),
                'ends_at' => Carbon::today()->setTime(0, 0),
                'resource_id' => '1',
            ],
        ]);
    }
@aliowacom
Copy link
Author

I was experiencing with the behaviour and it looks as follows:
when ends_at is less than starts_at, it flips it and looks for conflicting events. In case with 'Dinner' example, it looks for conflicting events from 0:00 till 18:00 and finds other two. If I set 'ends_at' to '13:00', it will conflict with only one event which is 'Lunch'.

To me, there are two things to implement:

  1. make 0:00 to be treated as 23:59 when checking neighbours
  2. throw exception if ends_at is less than starts_at (except 0:00)

@aliowacom aliowacom mentioned this issue Dec 9, 2021
2 tasks
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