[Remind-Fans] weekly shift rotation

David F. Skoll dfs at roaringpenguin.com
Wed Jan 21 12:32:06 EST 2009


Rob Hamrick wrote:
> Hi there, I'm trying to find the best way to write out my shift
> rotation at work.  We have four shifts (early, swing, late, off) and
> we rotate every week.

> REM Mon Tue Wed Thu Fri 2009 SATISFY [ ( weekno(trigdate()) % 4 ) == 0] MSG early%
> REM Mon Tue Wed Thu Fri 2009 SATISFY [ ( weekno(trigdate()) % 4 ) == 1] MSG swing%
> REM Mon Tue Wed Thu Fri 2009 SATISFY [ ( weekno(trigdate()) % 4 ) == 2] MSG late%
> REM Mon Tue Wed Thu Fri 2009 SATISFY [ ( weekno(trigdate()) % 4 ) == 3] MSG off%

This will not work well across year boundaries; some years have a
week number 53.  (I realize you've restricted the year to 2009, so that
might be moot...)

Really, what you have is a 28-day cycle, so here's how I would do it:

FSET _cycle(x) ((x - '2008-12-08') / 7) % 4
REM Mon Tue Wed Thu Fri SATISFY [_cycle(trigdate()) == 0] MSG late%
REM Mon Tue Wed Thu Fri SATISFY [_cycle(trigdate()) == 1] MSG off%
REM Mon Tue Wed Thu Fri SATISFY [_cycle(trigdate()) == 2] MSG early%
REM Mon Tue Wed Thu Fri SATISFY [_cycle(trigdate()) == 3] MSG swing%

(You may need to adjust the numeric constants so the right shifts show up.)
By subtracting from a known start date, it should work even across
multiple years.

Regards,

David.


> Thanks!
> Rob
> _______________________________________________
> Remind-fans mailing list
> Remind-fans at lists.whatexit.org
> http://lists.whatexit.org/mailman/listinfo/remind-fans
> 
> 




More information about the Remind-fans mailing list