Sunday, May 15, 2011

Bugs that come back to haunt you.

The funniest thing happened to me today while finalizing an editorial. I obviously used my handle tag script. But today, the old reliable script was crashing. At the end I found the source of the problem:

RATING_CLASSES = [ (-1,-1,'coderTextOrange'), (0,0,'coderTextBlack'), (1,899,'coderTextGray'), (900,1199,'coderTextGreen'), (1200,1499,'coderTextBlue'), (1500,2100,'coderTextYellow'), (2200,1e100,'coderTextRed') ] 

See the problem? What happens when a yellow coder has a rating between 2101 and 2199 ? ...

Then another issue appeared, one of the coders was not being recognized. I tried the profile search at topcoder and it turns out _ is actually a wild card in that search feature. So, _sunny will not return _sunny member profile, it will list a page of all the profiles that are 6 characters long and end with sunny. The workaround was simple, I just guessed that If I add a escape \ to the _ , it will no longer be considered a wildcard. So, searching for \_sunny leads directly to _sunny's profile. That is nice.

The point of this post is, I had to update the script in case anyone actually used it.

No comments :