Skip to content

Commit 708112c

Browse files
committed
feat: Implement filter of commits based on selected authors
Refs: #240
1 parent 6ba4662 commit 708112c

File tree

1 file changed

+20
-1
lines changed
  • binocular-frontend/src/visualizations/VisualizationComponents/bugfix/chart

1 file changed

+20
-1
lines changed

binocular-frontend/src/visualizations/VisualizationComponents/bugfix/chart/chart.tsx

+20-1
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,34 @@ export default (props: Props) => {
6060
}
6161
}
6262
};
63+
// TODO: Make the graph update without changing the graph
64+
// TODO: Merge authors
65+
// TODO: Branches and files
66+
// TODO: Delete commits
6367

6468
let preparedCommits: Commit[] = [];
6569
if (!props.commits || props.commits.length === 0) {
6670
preparedCommits = [];
6771
} else {
6872
// Sort commits
6973
preparedCommits = props.commits.sort((a, b) => new Date(a.date) - new Date(b.date));
74+
let tempCommits: Commit[] = [];
75+
// Filter out commits based on unselected authors
76+
// TODO: Assert commiters and selected authors are arrays
77+
const excludedAuthors = props.committers.filter((s) => !props.selectedAuthors.includes(s));
78+
console.log('Excluded authors', excludedAuthors);
79+
for (const commit of preparedCommits) {
80+
if (!excludedAuthors.includes(commit.signature)) {
81+
tempCommits.push(commit);
82+
}
83+
}
84+
preparedCommits = tempCommits;
85+
tempCommits = [];
86+
87+
// Filter out commits not in the selected branch
88+
89+
7090
// Filter based on rules in regexConfig
71-
const tempCommits: Commit[] = [];
7291
const regexCommitMessage = new RegExp('\\b' + props.regexConfig.commitMessage + '\\b', 'i');
7392
const regexIssueTitle = new RegExp('\\b' + props.regexConfig.issueTitle + '\\b', 'i');
7493
const regexIssueLabel = new RegExp('\\b' + props.regexConfig.issueLabelName + '\\b', 'i');

0 commit comments

Comments
 (0)