When I first starting get paid to program i made a bunch of mistakes like this. Thankfully my boss at the time was really into helping me learn from the mistakes. I ened up learning a lot about how to ask the right questions during the requirement process.
in reply to OT - How to deal with coders who don't do what they should
One of his favorite things to do in a situation like this would be to ask to use the code as intended ie in this case the stats you couldn't find. Doing this had two effects one it made me rememeber the mistake without having to berate me. I aslo ened up adding this to my QA process. After I get done with a piece of code I grab the requirements sheet and try the software based only on what is written on the req.