creating a very simple scheduling app
I am asking the user to tell me what day(s) they work, and whether on a given day they work morning, lunch, or evening
so, for a given user her data could be one or all of the points in the following matrix
morning lunch evening
mon
tue
wed
thr
fri
sat
sun
I need to quickly be able to retrieve this information so that I can alert the user that it’s time to go to work. I will have many users.
I don’t care about specific dates, or time. just the discrete days 1 through 7 and the 3 slots within each day. Certainly, there are many possible combinations.
I am considering how to store this information. And I am wondering if a bitmask is appropriate / feasible / the ‘way to go with something like this’ ? How would you approach this?
thanks!
While a bitmask will definitely work (employing 7 days X 3 shifts = 21 bits), my experience with these things is they always need modification. That is, a night shift is added, or shifts are otherwise changed.
Given that, I’d suggest building some flexibility into your app. Combine the bitmask idea with a table that defines what the bits represent. That way you can redefine and modify as you please. If you add a shift, just add a record to the definition table and update each employee’s mask.