problems.stats reduce context code, manage average time

Average time computed correctly (only times less than a day), and only
with the correct solves.

TODO: we should put a timer in detail view, to check that the
resolution time is less than a day.