Adding dates into Calendar
I'd like to get your feedback on my current strategy for updating my office hours scheduling system. I'm rewriting it to avoid laborious entry by allowing employees to have a set schedule rather than individually inputting office hours. Is there an easier/normal way for doing it other than what I am planning below?
I am using a simple calendar setup that receives events in an array from an events table and then displays them in a calendar. I want to rework the way events are added into the events table.
Currently: Employees can select a day, and then add individual office hours (Monday 9:00, 10:00, 11:00, 12:00 , 1:00, 2:00, etc.)
Goal: Employees select a set schedule (ex. Mon-Wed-Fri, from 8:00-5:00PST), and the system automatically adds future dates into the events table for display (one month in advance).
Current plan: Add a schedules table with employee ID, and fields for Mon-Sunday. Daily a CRON job runs that checks what day of the week is 28 days from now. It then queries the schedules to find all employees who have hours scheduled on that day of the week. Adds events into the events table 4 weeks in advance.
Is this a satisfactory way of doing it? Thanks! I'm new in coding, so yo开发者_如何学运维ur feedback before spending a lot of time implementing is helpful!
If their schedules are consistent, it makes good sense for each employee to have a default schedule. And it makes sense to have a cron job update the calendar automatically.
But you might give some thought to what should happen when someone wants to schedule vacation time (or make any arbitrary change to their schedule) more than a month into the future. Same issue when the owner wants to see who's scheduled to work over the summer and finds a blank calendar. (The point is that some people will invariably need to know something that the calendar doesn't yet cover. You need to plan for that. )
精彩评论