def _create_report_overview(data): """Number of hits, pages, visits, visitors and bandwith.""" empty_stats = {'hits': 0, 'pages': 0, 'bandwidth': 0, 'visits': 0} report = {} all_time = empty_stats.copy() if 'DAY' in data: for yyyymm, d in data['DAY'].items(): yyyy = yyyymm[:4] year = report.get(yyyy, None) if year is None: year = report[yyyy] = empty_stats.copy() month = empty_stats.copy() for day in range(1, 1 + get_number_of_days(yyyymm)): yyyymmdd = '%s%02d' % (yyyymm, day) info = d.get(yyyymmdd, {}) day_data = {'visitors': 0} # not reported by AWStats for key in ('hits', 'pages', 'bandwidth', 'visits'): day_data[key] = int(info.get(key, 0)) month[key] += day_data[key] year[key] += day_data[key] all_time[key] += day_data[key] report[yyyymmdd] = day_data month['visitors'] = data['GENERAL'][yyyymm]['TotalUnique'][0] report[yyyymm] = month report['all-time'] = all_time # FIXME: not used (yet) return report
def _create_report_overview(data): """Number of hits, pages, visits, visitors and bandwith.""" empty_stats = {'hits': 0, 'pages': 0, 'bandwidth': 0, 'visits': 0} report = {} all_time = empty_stats.copy() for yyyymm, d in data['DAY'].items(): yyyy = yyyymm[:4] year = report.get(yyyy, None) if year is None: year = report[yyyy] = empty_stats.copy() month = empty_stats.copy() for day in range(1, 1 + get_number_of_days(yyyymm)): yyyymmdd = '%s%02d' % (yyyymm, day) info = d.get(yyyymmdd, {}) day_data = {'visitors': 0} # not reported by AWStats for key in ('hits', 'pages', 'bandwidth', 'visits'): day_data[key] = int(info.get(key, 0)) month[key] += day_data[key] year[key] += day_data[key] all_time[key] += day_data[key] report[yyyymmdd] = day_data month['visitors'] = data['GENERAL'][yyyymm]['TotalUnique'][0] report[yyyymm] = month report['all-time'] = all_time # FIXME: not used (yet) return report
def _call_fut(self, yyyymm): from awstatic.utils import get_number_of_days return get_number_of_days(yyyymm)