danbartlett/opensit — pull request #135 by danbartlett (2014-06-30 20:57:33+00:00)
Title: [WIP] Goals backend

Backend mostly there. #129

**Todo**
* At the moment goals are either "fixed" (sit 30 days in a row), or "ongoing" (sit 30 mins a day). Users should be able to set a goal that combines both e.g. sit for 30 minutes a day, for 30 days.
* `days_where_goal_met` loops and calls `user#sat_on_date?` for each day, which leads to _lots_ of queries every time you want to know how many days a user has met their goal. Needs refactoring so that it gets all the days in one query, and then iterates through them. Same for `user#sat_for_x_on_date`