def _update_statistics(cur, startTime, intervalLen, statTypes): """Update all statistics with the most recent events from the database""" currentTime = DBUtil.get_current_gmtime() intervalStartTime = startTime - (startTime % intervalLen) #for each type of stat: for statType in statTypes: #for each interval: for period in range(intervalStartTime, currentTime, intervalLen): #calculate the statistic stat = statType(period, period + intervalLen) stat.calculate(cur) #update it in the database stat.update(cur)
def _update_statistics(cur, startTime, intervalLen, statTypes): """Update all statistics with the most recent events from the database""" currentTime = DBUtil.get_current_gmtime() intervalStartTime = startTime - (startTime % intervalLen) #for each type of stat: for statType in statTypes: #for each interval: for period in range(intervalStartTime, currentTime, intervalLen): #calculate the statistic stat = statType(period, period+intervalLen) stat.calculate(cur) #update it in the database stat.update(cur)