fix scheduled reports when there is no minute set

mid-sized refactor + tests included

http://manage.dimagi.com/default.asp?133813
Minor, I would recommend `assert period in ('daily', 'weekly', 'monthly'), period`