fix size of ram and data storage

This commit is contained in:
Cayo Puigdefabregas 2023-02-25 11:29:41 +01:00
parent c9d23d5e6a
commit fb413671fc
1 changed files with 8 additions and 6 deletions

View File

@ -1047,16 +1047,18 @@ class Computer(Device):
@property @property
def ram_size(self) -> int: def ram_size(self) -> int:
"""The total of RAM memory the computer has.""" """The total of RAM memory the computer has."""
return sum( components = self.components
ram.size or 0 for ram in self.components if isinstance(ram, RamModule) 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 @property
def data_storage_size(self) -> int: def data_storage_size(self) -> int:
"""The total of data storage the computer has.""" """The total of data storage the computer has."""
return sum( components = self.components
ds.size or 0 for ds in self.components if isinstance(ds, DataStorage) 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 @property
def processor_model(self) -> str: def processor_model(self) -> str: