I lied, date_range.count will always be at least 1. This code is pretty spaghetti-ish. I'll shoot for a refactoring soon.