calculate stats by time period
fixed merge conflicts