Commit f6b31d26 authored by Vincent Pelletier's avatar Vincent Pelletier

Add no-module stat line.

parent 1b74aad6
......@@ -220,10 +220,11 @@ class ERP5SiteStats(GenericSiteStats):
super(ERP5SiteStats, self).__init__(threshold, prefix=prefix)
# Key levels:
# - module id (string)
# - date (datetime.date)
# - is document (bool)
# - date (datetime.date)
self.module = defaultdict(partial(defaultdict, partial(
defaultdict, partial(APDEXStats, threshold))))
self.no_module = defaultdict(partial(APDEXStats, threshold))
def accumulate(self, match, url_match, date):
prefix = self.prefix
......@@ -232,7 +233,9 @@ class ERP5SiteStats(GenericSiteStats):
module = split[0]
if module.endswith('_module'):
super(ERP5SiteStats, self).accumulate(match, url_match, date)
self.module[module][date][len(split) > 2].accumulate(match)
self.module[module][len(split) > 2][date].accumulate(match)
else:
self.no_module[date].accumulate(match)
def asHTML(self):
result = []
......@@ -259,22 +262,23 @@ class ERP5SiteStats(GenericSiteStats):
getClassForDuration(data.duration_max, self.threshold),
float(data.duration_max) / US_PER_S,
)
def apdexAsColumns(caption, is_document, data_dict):
append('<td>%s</td>' % caption)
def apdexAsColumns(data_dict):
data_total = APDEXStats(self.threshold)
for data in data_dict.values():
data_total.accumulateFrom(data[is_document])
data_total.accumulateFrom(data)
append(apdexStatsAsHtml(data_total))
for date in column_list:
append(apdexStatsAsHtml(data_dict[date][is_document]))
append('</tr>')
append(apdexStatsAsHtml(data_dict[date]))
for module_id, data_dict in sorted(self.module.iteritems(),
key=ITEMGETTER0):
append('<tr><td rowspan="2">%s</td>' % module_id)
apdexAsColumns('module', False, data_dict)
append('<tr>')
apdexAsColumns('document', True, data_dict)
append('</table>')
append('<tr><th rowspan="2">%s</th><th>module</th>' % module_id)
apdexAsColumns(data_dict[False])
append('</tr><tr><th>document</th>')
apdexAsColumns(data_dict[True])
append('</tr>')
append('<tr><th colspan="2">(none)</th>')
apdexAsColumns(self.no_module)
append('</tr></table>')
append(super(ERP5SiteStats, self).asHTML())
return '\n'.join(result)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment