From 514a43f8a4305a14ebbcdbf02462320f37ce808f Mon Sep 17 00:00:00 2001 From: David Wallace Date: Thu, 8 Aug 2024 09:44:21 +0200 Subject: [PATCH] refactor(progress): simplify count of counts definition Signed-off-by: David Wallace --- rdmo/projects/progress.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rdmo/projects/progress.py b/rdmo/projects/progress.py index 2e5bcb0d8d..efe7421369 100644 --- a/rdmo/projects/progress.py +++ b/rdmo/projects/progress.py @@ -92,7 +92,7 @@ def compute_navigation(section, project, snapshot=None): counts = count_questions(page, sets, conditions) # filter the values_list for the attributes, and compute the total sum of counts - count = len(tuple(filter(lambda value: value[0] in counts.keys(), values_list))) + count = sum(1 for value in values_list if value[0] in counts) total = sum(counts.values()) navigation_section['count'] += count @@ -130,7 +130,7 @@ def compute_progress(project, snapshot=None): counts = count_questions(project.catalog, sets, conditions) # filter the values_list for the attributes, and compute the total sum of counts - count = len(tuple(filter(lambda value: value[0] in counts.keys(), values_list))) + count = sum(1 for value in values_list if value[0] in counts) total = sum(counts.values()) return count, total