7 Replies Latest reply on Feb 16, 2017 10:54 AM by littleluce

    Detecting Schedule Conflicts

    littleluce

      I have a reservation system that manages equipment and need to check for schedule conflicts. I have set it up using relationships as discussed in this post Detecting scheduling conflicts  but I have found it doesn't work in some cases where I need to allow a certain number of conflicts.

       

      For example, if I have 3 cameras that can be reserved I will allow up to 3 conflicting reservations containing at a time. The problem comes with overlapping reservations that conflict with some reservations, but not all. Take the example below

       

      Reservation A: Monday - Friday

      Reservation B: Monday - Tuesday

      Reservation C: Wednesday - Thursday

       

      From the context of Reservation B or C there is only 1 conflicting reservation, but from the context of Reservation A there are 2.

       

      How would I solve this issue? Is there a better way to mange conflicts in my situation?

        • 1. Re: Detecting Schedule Conflicts
          siplus

          As a general rule, allowing a certain number of conflicts collides with checking for conflicts.

           

          As I already said, exceptions should be handled separately.

           

          If you get the feeling that there are too many exceptions, it's time to revise the whole data model.

          • 2. Re: Detecting Schedule Conflicts
            DavidJondreau

            Sounds like you've got a field called "NumConflicts"? And a self join relationship relatedTable:: If so, make a new field, "Max Num Conflicts" =

            Let( [

            this.max = NumConflict ;

            other.max = Max ( relatedTable::NumConflicts ) ;

            max.conflicts = Max ( this.max ; other.max ) ] ;

            max.conflicts )

            • 3. Re: Detecting Schedule Conflicts
              user19752

              This is different problem from "should't conflict"

              MonTueWedThuFri
              AAAAA
              BB
              CC

              A has 2 conflicts as you wrote, but this may be allowd on "you have 2 cameras" case, not reached "up to 2 conflicting reservations".

              • 4. Re: Detecting Schedule Conflicts
                littleluce

                Yes, that is correct. However my calculations right now just count the number of conflicts across the relationships and compare that to the quantity (total stock) of any one piece of equipment. I don't know how to check for conflicts on only a certain day like you can show in that table. I provided only a simple example—in reality I'm verifying reservations by timestamp. The same situation could occur all within one day

                • 5. Re: Detecting Schedule Conflicts
                  littleluce

                  I think this method could work, but wouldn't I want Minimum Number of conflicts instead? My maximum conflicts is simply determined by the total stock of a product. In my example Reservation A should see that only 2 of the 3 cameras are reserved.

                  • 6. Re: Detecting Schedule Conflicts
                    DavidJondreau

                    It really depends on what the user experience is supposed to be. What is happening? Is a user entering a reservation in with a timestamp and getting alerted if there aren't enough cameras? Is a user opening up the system in the morning and seeing a list of conflicts? Looking at a calendar and seeing flags on conflict days? What's the implementation?

                    • 7. Re: Detecting Schedule Conflicts
                      littleluce

                      Most of the time the user is entering a set of start and end timestamps and then needs to see a list of what's available. I have logic that prevents users from adding items to the reservation if they conflict (they are shown as "out of stock"). There is also cases where the user will change the end timestamp of the reservation to check for conflicts, and an alert will warn them if that change caused a new conflict.