The Rails app I’ve been poking at for a while is pretty frivolous. A fried of mine started a regular playing night for Formula De, a car racing game based on Formula 1 (and shame on them for racing in Bahrain). He wanted it done as a league, complete with teams, driver names, scoring, etc. So in 2001, the Bayou Grand Prix was born.

I coded the first version of the web site - and as you can see, it’s pretty ugly. My minimalist HTML design skills aside, it’s coded in plain PHP on top of a SQL layer, and most of the logic is encoded in the SQL.  Given the scoring rules, and the need to support things like drivers racing for different teams in the same season, things got pretty ugly, with queries like this:

select d.name, t.color, SUM(sg.points), t.name
from raceresults rr, races r, scoring sg, drivers d, 
teams t, seasondrivers sd, schedule k where
k.season = $season and
k.race = r.id and 
rr.race = r.id and
rr.driver = d.id and
rr.place = sg.place and
rr.dnf = FALSE and
sd.driver = d.id and
sd.defaultteam = t.id and
sd.season = k.season and
sg.scheme = $schemeid
group by d.name, t.color, t.name
order by 3 desc, 1;

And the administrative interface is pretty bad as well. I quite often have to go in and frob the database with raw SQL to fix things when I screw up the data entry - meaning that effectively I’m the only one who can update the thing.

So sometime in 2008 I started a project to write a new version in Rails. I’ve been poking at it from time to time ever since, but it still hasn’t reached feature parity with the current SQL site. Getting there, though.