OakCH / scheduler

Vacation Scheduler for the Oakland Children's Hospital
7 stars 10 forks source link

Rules preventing update of event #137

Closed batailleye closed 12 years ago

batailleye commented 12 years ago

Rules logic prevents adding a day to the segment for nurse 1 (the nurse 1 after one runs: rake db:reset_and_seed). The error I get is: "Max day You have selected a day that has no more availability"

sheelc commented 12 years ago

Good catch! Seems the rules are counting the event to be updated as some other event which already exists and is determining that there is already a nurse off during that time period. @christinelu, can you take the lead on this?

sheelc commented 12 years ago

@christinelu says she will handle it!

batailleye commented 12 years ago

Yep, the problem is that we are taking into account the same event twice. A way to solve this (and improve performance) is to modify less_than_max_per_day? so that it checks if entire segments overlap (as opposed to single days). Basically, I was going to use the code I wrote in overlaps? (i.e., extract that code and create a new method) to handle this. Christine, I'm assuming you are handling this (per Sheel's request).

sheelc commented 12 years ago

Yeah since you both worked on Rules feel free to work on it together but I made Christine lead since David is working on PTO.

christinelu commented 12 years ago

Yes, I'll handle this one. I'm off the clock studying for the GMAT exam I'm taking tomorrow morning, so I will get to this tomorrow afternoon.

christinelu commented 12 years ago

@sheelc you are such a manager, "Good catch!" :P