From fb413671fcb04629ed8d498e4042d303ff5c66c8 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Sat, 25 Feb 2023 11:29:41 +0100 Subject: [PATCH] fix size of ram and data storage --- ereuse_devicehub/resources/device/models.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 566d7d85..d406d808 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -1047,16 +1047,18 @@ class Computer(Device): @property def ram_size(self) -> int: """The total of RAM memory the computer has.""" - return sum( - ram.size or 0 for ram in self.components if isinstance(ram, RamModule) - ) + components = self.components + if self.placeholder and self.placeholder.binding: + components = self.placeholder.binding.components + return sum(ram.size or 0 for ram in components if isinstance(ram, RamModule)) @property def data_storage_size(self) -> int: """The total of data storage the computer has.""" - return sum( - ds.size or 0 for ds in self.components if isinstance(ds, DataStorage) - ) + components = self.components + if self.placeholder and self.placeholder.binding: + components = self.placeholder.binding.components + return sum(ds.size or 0 for ds in components if isinstance(ds, DataStorage)) @property def processor_model(self) -> str: