From 466cc778d4444541e4cc0d8ca79a1ff425549cb3 Mon Sep 17 00:00:00 2001 From: mgrani Date: Fri, 5 Jul 2024 12:04:14 +0200 Subject: [PATCH] fix: summary stats in ls command not correctly calculated when fields have been empty --- owilix/cmd/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/owilix/cmd/base.py b/owilix/cmd/base.py index 6c21958..498dfdd 100644 --- a/owilix/cmd/base.py +++ b/owilix/cmd/base.py @@ -330,9 +330,9 @@ class BaseCommand(metaclass=SubCommandMeta): resource_counter = Counter([row.resourceType for row in data if hasattr(row, "resourceType")]) dataCenter_counter = Counter([row.dataCenter for row in data if hasattr(row, "dataCenter")]) # Gather numerical data - object_counts = [row.objectCount for row in data if hasattr(row, "objectCount")] - total_sizes = [row.totalSize for row in data if hasattr(row, "totalSize")] - total_files = [row.fileCount for row in data if hasattr(row, "fileCount")] + object_counts = [row.objectCount for row in data if hasattr(row, "objectCount") and row.objectCount is not None] + total_sizes = [row.totalSize for row in data if hasattr(row, "totalSize") and row.totalSize is not None] + total_files = [row.fileCount for row in data if hasattr(row, "fileCount") and row.fileCount is not None] # Calculate summaries for numerical data total_object_count = sum(object_counts) -- 2.51.2