Thinking about your data a litte, I would say choose the approach which works best for the fact that you are likely to have a flutuating employee list, whereas the shifts arent as likely to change. In my mind, that would explain a 'shift-is-worked-by' structure.

Or even, a date-oriented structure, since the shifts repeat themselves daily as well. So you'd have a table with shifts and shift IDs, a table with employees and employee IDs, and a table combining the two, mapping date, shift ID and employee ID together. This third table can then continue indefinitely (tho of course you'll probably want to periodically remove old data). It has a double-index of date and shift ID.

Code-wise, you then calculate 'today and next seven days', look up those dates in the table, translating shift IDs to times, and employee IDs to names as you go, and making some sort of hash:

%current = ( '2003-12-05' => { { 'time' => '9:00 AM', 'id' => 1, 'employee' => {'id' => 1, 'name => 'Fred Flintst +one', } }, { 'time' => '5:00 PM', 'id' => 2, 'employee' => { 'id' => 4, 'name' => 'Wilma', } { 'time' => '1:00 AM', 'id' => 3, 'employee' => { 'id' => 3, 'name' => 'Barney', } }, '2003-12-06' => { ... }
Which you can display and/or work on as required. I hope this makes some sort of sense, Im just thinking as I type (which sometimes has weird results..)

C.


In reply to Re: Rostering Staff: Architecture? Not strictly Perl by castaway
in thread Rostering Staff: Architecture? Not strictly Perl by Cody Pendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.