So I’ve come at this a couple of ways, but all of my solutions look
awful, and I’m betting there’s a (more) elegant way to do this. I’m sure
there’s an array jocky who knows how to do this elegantly. Notice that
there are a couple of data points missing in the list of times (john was
out tues and mark monday, slackers…).
I’m using MySQL and Ruby 1.8.6
any help appreciated,
-s
I’m trying to turn this:
Name Day Time
john mon 8
john wed 7
john thu 9
john fri 7
susan mon 8
susan tue 8
susan wed 9
susan thu 7
susan fri 7
mark tue 6
mark wed 5
mark thu 6
mark fri 5
Into this:
Job #6
mon tue wed thu fri sat sun total
john 8 - 7 8.5 7 - - 30.5
susan 8 8 8.5 7 7 - - 38.5
mark - 6 5 6 5 - - 22