TracksApp/tracks — pull request #195 by doncruse (2013-07-19 05:30:58+00:00)
Title: Removing some intermediate values and shifting HTML formatting to a helper

These changes further streamline the two "last year" methods, which makes a dent into the complexity of the StatsController. (On CodeClimate, this commit would reduce the complexity from 724 to 666, which although still ominous, is at least a step in the right direction.)

The most common changes here are removing intermediate values that do not show up in a view.

I remain a little puzzled why the "actions_done_lastyears_data" method -- despite its name -- has no date constraint on the recency of events shown. It seems to take all of the data, regardless of age, so that the rolling averages must be estimated at the farthest endpoints. I don't know if this is the expected behavior. By contrast, the "actions_done_last12months_data" method is scoped to display the last 12 months of data (with a few extra months also being used so the rolling averages are more precise).