diff --git a/pom.xml b/pom.xml
index 24332bd..856bb48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
api-audit
jar
${project.groupId}:${project.artifactId}
- 3.7.23-SNAPSHOT
+ 3.7.24-SNAPSHOT
Hygieia Audit Rest API Layer
https://github.com/Hygieia/${repository.name}
diff --git a/src/main/java/com/capitalone/dashboard/evaluator/CodeReviewEvaluator.java b/src/main/java/com/capitalone/dashboard/evaluator/CodeReviewEvaluator.java
index d477778..7143b7d 100644
--- a/src/main/java/com/capitalone/dashboard/evaluator/CodeReviewEvaluator.java
+++ b/src/main/java/com/capitalone/dashboard/evaluator/CodeReviewEvaluator.java
@@ -227,11 +227,16 @@ private CodeReviewAuditResponseV2 getPeerReviewResponses(CollectorItem repoItem,
if (noPR.getCommits().isEmpty()){continue;}
// get the latest commit & filter out merge commit by checking non-matching scmNums
- noPR.getCommits().sort(Comparator.comparing(Commit::getScmCommitTimestamp).reversed());
+ noPR.getCommits().sort(Comparator.comparing(Commit::getScmCommitTimestamp));
Commit lastCommit = noPR.getCommits().get(noPR.getCommits().size()-1);
+ // refine list of PRs to search through (created after PR and merged before the merge of the noPR)
+ List refinedPRList = peerReviewed.stream().filter(
+ pr -> pr.getCreatedAt() >= noPR.getCreatedAt()).filter(
+ pr -> pr.getMergedAt() <= noPR.getMergedAt()).collect(Collectors.toList());
+
// iterate through the peerReviewed and their commits to see if the failed PR's commit exists in there
- for (GitRequest yesPR: peerReviewed.stream().filter(pr -> pr.getCreatedAt() >= noPR.getCreatedAt()).collect(Collectors.toList())) {
+ for (GitRequest yesPR: refinedPRList) {
for (Commit commit: yesPR.getCommits()) {
if (lastCommit.getScmRevisionNumber().equalsIgnoreCase(commit.getScmRevisionNumber())){