CSV Export Enhanced

It is somewhat duplication of the Report Generator functionality but I went ahead and enhanced the CSV Roster Export to include the age, adjusted age, and the age group assignment.  With the clean up of the age group calculation, the information is now readily available any time a swimmer record is queried.  As such, the age and age group now appear on the detail profiled as well as a couple other places.

Finally fixed age calculation

Over the weekend I was speaking with one of the swim team parents who was asking me about our web site and I showed her what she could see about her daughter.  As soon as I popped her daugher’s information she noticed that she was placed in the wrong age group.  Oops.

I had seen this situation previously but couldn’t pin it down but now that I had a swimmer I could test against, I dug into it.  It turns out that I had made the age calculation much, much, harder than it really needed to be.  And it was wrong.

I was trying to use MySQL’s PERIOD_DIFF() function so the age and cutoff date adjusted age would be returned as part of the query.  It turns out that PERIOD_DIFF() only accounts for months (which I knew when I used it) but not taking into account the days causes the calculation to be wrong and limits the age cutoff date to be the first  of a month which may or may not be acceptable.

My first search yielded this example which turns out to be wrong as it doesn’t always return the correct age.

Here is the correct SQL to calculate age:

SELECT YEAR(birthdate) - (MONTH(CURRENT_DATE()) < MONTH(birthdate)) -
    ((MONTH(CURRENT_DATE()) = MONTH(birthdate)) & (DAY(CURRENT_DATE()) <
    DAY(birthdate))) AS age 

Here is the correct SQL to calcualte age based on a specific cutoff date, in this case the cutoff date is June 1st:

SELECT YEAR(CURRENT_DATE()) - YEAR(birthdate) - (MONTH('2008-06-01') <
    MONTH(birthdate)) - ((MONTH('2008-06-01') = MONTH(birthdate)) &
    (DAY('2008-06-01') <= DAY(birthdate))) AS agegroupage

By using the calculations, the swimmer’s age and age group age are always returned with the query as opposed to computed on the fly.

Working on my WordPress Swim Team plugin

For the last few months I have been writing a WordPress plugin called wp-swimteam.  This plugin builds on top of WordPress to turn it into an application which can be used to manage a youth swim team.  The plugin is hosted on SourceForge and I am using a blog on that site to track the development progress.  It is going pretty well, I am having fun working on it as it will be a huge benefit to our swim team which has been driven by a paper process forever.

Rock Band Drums are loud

I am finding playing Hard guitar really hard and I don’t have the time to dedicate to getting better, I just want to have fun and play.  My son had some friends over the other day so the drums were out and I decided to see if I could play them.  My last attempt was when we first got Rock Band and I was a miserable drummer and couldn’t get through a song.

I was able to play the warm up songs without any problem this time albeit I am playing on Easy.  But that is ok, it is fun to try something else.  The drums are loud though.  I picked up a set of the new Rock Band Drum Silencers the other day but they don’t seem to fit the drums correctly so before I cut them up I need to call their customer support number.  Since we tend to play late at night, in order to play the drums I need them to be quieter!

Got in a late 9

After dinner last night I went out an got in a late 9.  It was going to be tight so I didn’t even hit anything before I teed off on #1.  I paid for it too – a triple bogey on #1.  Tee shot on #2 wasn’t very good either but my second shot was excellent and after two putts I had a par.  For the most part I played decent, putted well, no 3 putts at all.  I had two crappy wedge shots and made a couple poor club choices, particularly on the two par 5s which I played in a total of +5.

MDCC is rebuilding the blue tees on a couple holes so some the blue tee markers are relocated.  On #7 the hole plays about 40 yards shorter but #9 plays about 40 yards longer.  #9 was playing 575 yards from the blues yesterday!  It is already a long hole for me, when you add 40 yards to it, it makes it really long!  I had a good drive (240-250) but a terrible second shot.  A nice third shot left me with a 40 yard wedge to the green.  These are the shots I struggle with.  I really tried to accelerate through the ball and I hit is pretty well.  Too well – it landed near the flag which was on the back, and rolled over the green and down the hill into the pine straw!  Another tough wedge back to the green, a two putt for a 7.

I finished with a 48.  I need to eliminate the triple bogyes (I had two plus one double).  I’ll chalk one of them up to not warming up on #1 but there was no excuse for a +3 on #5 though.  Especially since I was on the green in 3 the day before when I played with the girls in the MDCC parent child tournament.

I am hoping to get out again tonight for another late twilight round.  Except for the tough sun on a couple holes, particularly #2, I love playing at that time of the day.  The course is quiet and you can play quickly (I played in an hour and a half last night), it is a nice end ot the day.

I really need a new phone …

I really need a new phone.  Since I squashed my Pantech I have been using my old AudioVox.  The AudioVox was a good phone three or four years ago but now it seems ancient.  I miss my 3G phone!  I don’t know what to do, if I get something now I’ll probably get another Pantech Duo or possibly the AT&T Tilt.  I know as soon as I commit to a phone, something new will come out.  It always seems to work out that way.

Missed tee time at TPC Wakefield and MDCC parent-child tournament

Because I got stuck in Dallas on my way home from Denver on Thursday, I wasn’t home in time to play on Friday with one of my co-workers who is a member at TPC Wakefield.  I haven’t played there in a while so I was looking forward to it.

Because I was out of town all week I didn’t play any golf until yesterday when I played the Parent/Child tournament at MDCC.  I played with two of my girls and we had a good time.  I hit the ball ok considering I had to keep my 6 year old and 8 year old from picking at each other too much.  There was a larger turn out than expected so play was pretty slow.  Even with a shot gun start it took us 3 hours to complete 9 holes.  We had a couple pars and a birdie and only one double-bogie for a round of 43.  The low score was something rediculous like 32.  There wasn’t any seeding based on age or handicap which they really need to do.  A good golfer playing with a good child would mop up.

Young kids (like mine) play from the “Carolina” tees which are painted blue bricks located at the beginning of the fairway much like courses that have First Tee markers.  On some holes, these tees are 150-180 yards closer so we played a couple of my kids drives when theirs had a better lie than mine.  One of my girls also knocked down some nice putts including our lone birdie.

MacBook Pro? Dell XPS1330?

I need a new laptop and need one soon.  My HP is on it last legs.  On my way home from Denver the other day (a crappy trip home, I missed my connection and had to sepnd the night in Dallas due to the tornados in the Denver area) it acted as if the delete key was stuck again and deleted about two weeks worth of e-mail.  It is a real PITA when it does this.  I end up having to go back through my deleted items to determine what shouldn’t be deleted.

Anyway, enough whining about that.  I am going to get a new laptop.  My employer has standardized on Dell machines although there are exceptions (I have had an HP for a while).  I have mentioned earlier that I like the Dell Latitude X1 I borrowed from one of our IT guys so I am thinking of going small and light instead of high end workstation replacement.

I wish the Dell XPS1330 had a good docking station solution – the lack of one is the only thing which turns me off.  I am also intrigued by the Mac – if I get one it would be the 15″ MacBook Pro.  The only thing which I don’t like about the Mac is the lack of a three button mouse because I will have to run Windows on it too.

Decisions, decisions.  Going the Dell route will be easier because I will have IT support (if I want it) but I also like the idea of the Mac – they are really elegant machines.  Either way, I want to make a decision next week – I am headed to Europe in a couple weeks and would like to have it before I go although it is unlikely.

Report Generator

I have started working on a report generator for the plugin.  The report generator will allow an administrator to run reports for the swim team with control over what is included in the report as well as the ability to apply filters.  The report can be generated as either a web page (table) or as a CSV download which could then be loaded into Excel.  For the most part I have completed the GUI, now I need to actually generate the report.

Fixes to SDIF, Age calculation, and other stuff

It has been a pretty hectic week for Swim Team and as such, I have found some bugs and some minor annoyances and tried to fix most of them.  The most serious bug was in the SDIF export which I was working with one of our coaches on so he could started working with WinSwim with our roster.  If the parent profile wasn’t entered, the last last profile found was being used to construct the D1 and D2 records.  Now when a parent profile record isn’t found, it reverts to the site admin’s record to populate the data.

I also switched a bunch of the swimmer lists (roster, all swimmers) back to sorting by last name because that is how the data is usually looked at.  I also fixed a bug in the age computation which was rather elusive – it only appeared once in a while.  It turns out the logic was wrong in an age computation function I had grabbed off a PHP site a while back.  Lastly, I made progress on the swimmer id/number/label but am not yet computing them.  I think all of the infrastructure for them is down now.