Open michaelhayman opened 12 years ago
Add a start date and an end date. Scheduleable and scheduleable_id
rails generate scaffold Schedule scheduleable_id:integer scheduleable_type:string day_id:integer start_time:integer end_time:integer min_hours:integer max_hours:integer start_date:date end_date:date
Limitation of this is that schedules can't overlap days, i.e. an opportunity can't last from 11 pm on Monday till 2 am on Tuesday.
DateTime.new(params[:year],params[:month],params[:day])
A lot of validation needs to be done with schedules:
for opportunities: start date > end date
for schedules: start time > end time min hours > max hours
does min/max hours make any sense really?
Model:
Volunteers - 1 Opportunities - 2
DayID|Start|End|MinimumHours|MaximumHours|ScheduleableID 1|12|17|1|3|1 1|12|15|2|3|2 2|15|18|3|3|2
For each day ID where ScheduleableID = volunteer, check for records that are => start AND =< End AND where Opportunity.MinimumHours are less than or equal to Volunteer.MaximumHours where ScheduleableID = opportunity