From ca710b143b689eb6c9fc3b1c94fdc80aae2e5acc Mon Sep 17 00:00:00 2001 From: iliya Date: Thu, 26 Feb 2026 21:50:23 +0200 Subject: [PATCH] fix: improve file tracking in MemberStatsComputer - Updated the handling of bash lines to ensure unique file tracking by using a Set to eliminate duplicates. - Added logic to attribute per-file line changes only when a single file is touched, enhancing accuracy in line addition and removal reporting. --- src/main/services/team/MemberStatsComputer.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/services/team/MemberStatsComputer.ts b/src/main/services/team/MemberStatsComputer.ts index 5b8b28ed..6443436b 100644 --- a/src/main/services/team/MemberStatsComputer.ts +++ b/src/main/services/team/MemberStatsComputer.ts @@ -271,9 +271,14 @@ export class MemberStatsComputer { const bashLines = estimateBashLinesChanged(cmd); linesAdded += bashLines.added; linesRemoved += bashLines.removed; - for (const f of bashLines.files) { + const touchedFiles = [...new Set(bashLines.files)]; + for (const f of touchedFiles) { trackFile(f); - addFileLines(f, bashLines.added, bashLines.removed); + } + // Only attribute per-file lines when a single file is touched; + // with multiple files we can't determine per-file distribution + if (touchedFiles.length === 1) { + addFileLines(touchedFiles[0], bashLines.added, bashLines.removed); } } }