views:

45

answers:

2

Hi

I have a simple application with a customer and appointment models, system admin can create customer and create appointments for that particular customer, is there a Rails plugin that handles scheduling to ensure no two appointments overlap each other? i.e no two appointments at the same time.

A plus would be if I can set up more than one schedule, i.e shop has 2 instructors for lessons, when selecting appointment we can select which instructor etc.

What's the best way to do this?

Thanks

A: 

Not that I know of. It's fairly simple in theory, though. Subtract Time B from Time A, and if they're within X minutes of each other (however long an appointment takes), there's a conflict.

rspeicher
A: 
def is conflicting    
    if(appointemnt1_start < appointment2_end && appointment2.start < appointment1.end)
      return true 
    end
end
Mo