Commit 2cbdb36e authored by Vincent Pelletier's avatar Vincent Pelletier

Add forgotten "status" history save, restore and accumulate.

parent 6a7139b9
...@@ -396,6 +396,9 @@ class GenericSiteStats(object): ...@@ -396,6 +396,9 @@ class GenericSiteStats(object):
attribute = getattr(result, attribute_id) attribute = getattr(result, attribute_id)
for key, apdex_state in state[attribute_id].iteritems(): for key, apdex_state in state[attribute_id].iteritems():
attribute[key] = APDEXStats.fromJSONState(apdex_state, getDuration) attribute[key] = APDEXStats.fromJSONState(apdex_state, getDuration)
status = result.status
for status_code, date_dict in state['status'].iteritems():
status[status_code].update(date_dict)
return result return result
def asJSONState(self): def asJSONState(self):
...@@ -405,6 +408,7 @@ class GenericSiteStats(object): ...@@ -405,6 +408,7 @@ class GenericSiteStats(object):
'error_url_count': getattr(self, 'error_url_count', None), 'error_url_count': getattr(self, 'error_url_count', None),
'url_apdex': _APDEXDateDictAsJSONState(self.url_apdex), 'url_apdex': _APDEXDateDictAsJSONState(self.url_apdex),
'apdex': _APDEXDateDictAsJSONState(self.apdex), 'apdex': _APDEXDateDictAsJSONState(self.apdex),
'status': self.status,
} }
def accumulateFrom(self, other): def accumulateFrom(self, other):
...@@ -419,6 +423,11 @@ class GenericSiteStats(object): ...@@ -419,6 +423,11 @@ class GenericSiteStats(object):
self_attribute = getattr(self, attribute_id) self_attribute = getattr(self, attribute_id)
for key, apdex_data in getattr(other, attribute_id).iteritems(): for key, apdex_data in getattr(other, attribute_id).iteritems():
self_attribute[key].accumulateFrom(apdex_data) self_attribute[key].accumulateFrom(apdex_data)
status = self.status
for status_code, other_date_dict in other.status.iteritems():
date_dict = status[status_code]
for date, count in other_date_dict.iteritems():
date_dict[date] += count
class ERP5SiteStats(GenericSiteStats): class ERP5SiteStats(GenericSiteStats):
""" """
......
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