michaelhayman / Reciprocity

http://stark-window-6749.heroku.com/
1 stars 0 forks source link

Implement schedule matching: when adding opportunities, and display suitable ones on the calendar #4

Open michaelhayman opened 12 years ago

michaelhayman commented 12 years ago

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

michaelhayman commented 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])

michaelhayman commented 12 years ago

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?