From b9d85a8399b79cab5a13fbc66f8e0d6f478197d7 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Fri, 22 Dec 2023 14:09:37 +0000 Subject: [PATCH] Loop over all namespaces for committers/reviewers When populating the committer and reviewer counts in the report dictionary, loop through all repository namespaces rather than only those which appear in the committers and reviewers tables. This corrects a bug which caused those counts to be omitted entirely from the reports rather than reporting zero counts, particularly problematic in the tabular rendering as it shifted subsequent cells in those rows to the left. Change-Id: I47a179c1ebbe49ea3fd1a1c58dd815d190c30cc7 --- engagement/stats.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/engagement/stats.py b/engagement/stats.py index f4361f6..1ea7c3a 100755 --- a/engagement/stats.py +++ b/engagement/stats.py @@ -464,18 +464,16 @@ def main(verbose=0): message['id'], message['date'])) all_committers = set() - for namespace in committers: - report['repo_namespaces'][namespace]['committers'] = len( - committers[namespace]) - all_committers = all_committers.union(committers[namespace]) all_reviewers = set() - for namespace in reviewers: + for namespace in report['repo_namespaces']: + report['repo_namespaces'][namespace]['committers'] = len( + committers.get(namespace, set())) + all_committers = all_committers.union(committers.get(namespace, set())) report['repo_namespaces'][namespace]['reviewers'] = len( - reviewers[namespace]) - all_reviewers = all_reviewers.union(reviewers[namespace]) - for namespace in projects_active: + reviewers.get(namespace, set())) + all_reviewers = all_reviewers.union(reviewers.get(namespace, set())) report['repo_namespaces'][namespace]['projects_active'] = len( - projects_active[namespace]) + projects_active.get(namespace, set())) ml_activity = {'_total': {}} for scalar_month in range(