I am trying to implement a feature where employees are rotating a tasks assignment based on the schedule created. In most cases, employees are assigned a task on a rotating daily, weekly, biweekly, or monthly basis.
For example, we have 4 employees: John, Peter, Avit, Jane For a daily schedule, John may be responsible for the task the first week, Peter the second week, etc
There are also times where an employee might be on vacation. For example, John is on PTO for the first 2 days while he is assigned to the task and Avit takes over for those 2 days, when John is back on Day 3 he takes back the task assignment. I am trying to figure out how I can implement such a scheduling feature with ice_cube.
I know how to create a schedule with reoccurrence and exceptions. But I am not sure how to incorporate this with the concept of rotating amongst a set of users with overrides.
I have implemented a model called ScheduleUser, which stores the user_id and priority value. I have a delayed job that runs on each occurrence date/time which rotates the value in the priority column for each user. The person assigned to the task is the one with the highest priority.
This works fine for the simple use case, however when I have to override (partially or for the entire duration) an employee assignment then this doesn't work.