Encapsulate the stats for actions on the stats index page

As I was poking around in there I found a bug, so I put the `time to complete` calculations in its own class in order to add some tests (and fix the bug).