It’s not like my work makes a huge impact on humanity, or anything like that, but once in a while I do something that gives me a nice feeling of accomplishment. I built a dynamic web calendar some time ago, that provides a two month rolling window, minus the weekends. I was quite pleased that I was able to figure out how to make it, at the time, but it had room for improvement.
We have multi-tiered organizations, where I work. There are many departments, groups, and sub-groups. My calendar shows a complete group’s schedule, sorted by its sub-groups, with the supervisor and leads highlighted. The beauty of this particular calendar is that a supervisor (or anybody) can see at a glance the coverage (or lack thereof). Availability is important where I work, as we are a service organization.
Each person has control over their schedule and can input their planned out of office days. Each type of absence has its own color code. We also have flexible work schedules, where our pay periods are two week intervals. We can work non-standard schedules (within reason), as long as we work 80 hours every two weeks. In general, that means 4×10 hour days each week (a day off each week), or 80 hours/9 days each pay period (a day off every other week). I originally had a table look-up function where I had a sub-set of alternate schedule possibilities and holiday dates pre-loaded. Not very robust. It worked, but wasn’t very elegant, and I had to manually update the table each year to load the next year’s dates. And there are so many possible day off combinations. Too. Much. Work.
So. I made it calculate on the fly. It doesn’t sound like much, but I am quite pleased with myself for figuring it out. It’s not the most efficient code. It’s nearly 900 lines, after all. And, I probably reinvented the wheel, because someone else has probably already done this. All the same, I did it, and it works. For leap years, as well. Imagine that! It can calculate all the 4×10 and 9×80 alternate work schedules, and company holidays. Each day for each person, it says, hey, I am dd-mm-yy. What kind of a day am I Am I a day off Am I an alternate schedule day off Am I a vacation day Okay then. I will be color X. Next And so on. Yes, there is a LOT of looping taking place.