I want to set up a system where freelance employees can say on which days they can work. They can also say if they can work in the early or the late shift. The manager can input a period (start date, end date) and see which employees are available for work. This is a fairly simple system.
I was thinking of setting it up like this:
Code:
user_id | date | shift
-------------------------------
1 | 2007-05-21 | 1
1 | 2007-05-22 | 1
2 | 2007-05-21 | 2
etc...
This works, but although I am not a newbie anymore I miss the expertise to judge if this is a good solution. I think if you have 500 employees that can each work 100 days of the year on both shifts, you have 500 * 100 * 2 entries. This sounds like a lot! Is there a more efficient way?
Many thanks in advance for sharing the insight.
(ps. the reason I work with seperate days insetad of a from-date and till-date field, is that the manager can also request the employee for just one or a few days. Then I would either have to split the dates (original-from-date to new-till-date, new-from-date to old-end-date) for each time this happens, or calculate something like this for each employee: from-date to till-date, minus first period (from/till) the employee is "booked", minus the second period the employee is booked etc. This doesn't sound efficient at all)