From 79902ee26d8f41e9ed98f69bd7ecdd22543835b5 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 23 Feb 2021 12:23:07 +0100 Subject: [PATCH] adding lives action to the document of internal stats --- CHANGELOG.md | 1 + ereuse_devicehub/resources/documents/device_row.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 391163d2..141fb297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ml). [1.0.5-beta] ## [1.0.5-beta] +- [addend] #124 adding endpoint for extract the internal stats of use ## [1.0.4-beta] - [addend] #95 adding endpoint for check the hash of one report diff --git a/ereuse_devicehub/resources/documents/device_row.py b/ereuse_devicehub/resources/documents/device_row.py index fedef026..fd37760f 100644 --- a/ereuse_devicehub/resources/documents/device_row.py +++ b/ereuse_devicehub/resources/documents/device_row.py @@ -413,7 +413,9 @@ class InternalStatsRow(OrderedDict): for ac in self.actions: self.is_snapshot( self.is_deallocate( - self.is_allocate(ac) + self.is_live( + self.is_allocate(ac) + ) ) ) @@ -422,6 +424,11 @@ class InternalStatsRow(OrderedDict): self['Allocates'] += 1 return ac + def is_live(self, ac): + if ac.type == 'Live': + self['Lives'] += 1 + return ac + def is_deallocate(self, ac): if ac.type == 'Deallocate': self['Deallocates'] += 1