Skip to content

Commit

Permalink
fix numeric reflex
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzy11 committed Aug 13, 2024
1 parent 2a661d1 commit 2ced6c1
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,20 +331,15 @@ private List<TestReflex> getReflexTests(TestReflexBean reflexBean) {
return new ArrayList<>();
}
String resultType = testService.getResultType(reflexBean.getResult().getTestResult().getTest());
List<TestReflex> reflexesForResult = reflexResolver.getTestReflexesForResult(reflexBean.getResult());
List<TestReflex> reflexesForResult;
if (resultType.equals("D")) {
reflexesForResult = applyDictionaryRelationRulesForReflex(reflexBean.getResult());
} else if (!resultType.equals("D")) {
if (resultType.equals("N")) {
reflexesForResult = reflexesForResult.stream()
.filter(test -> applyNumericRelationRulesForReflex(test, reflexBean.getResult()))
.collect(Collectors.toList());
} else {
reflexesForResult = reflexesForResult.stream()
.filter(test -> applyTextRelationRulesForReflex(test, reflexBean.getResult()))
.collect(Collectors.toList());
}
reflexesForResult = reflexResolver.getTestReflexsByAnalyteAndTest(reflexBean.getResult());
} else {
reflexesForResult = reflexResolver.getTestReflexesForResult(reflexBean.getResult());
}
reflexesForResult = reflexesForResult.stream()
.filter(e -> isTestTriggeredByResult(e.getAddedTest(), reflexBean.getResult()))
.collect(Collectors.toList());
return reflexesForResult;
}

Expand Down Expand Up @@ -895,13 +890,13 @@ public boolean doesDictionaryRelationRulesForReflexApply(Test potentialReflexTes

private boolean doesNumericRulesForReflexApply(Test potentialReflexTest, Result potentialTriggerResult) {
List<TestReflex> reflexesForResult = reflexResolver.getTestReflexesForResult(potentialTriggerResult);
return reflexesForResult.stream().anyMatch(test -> test.getAddedTest().equals(potentialReflexTest)
return reflexesForResult.stream().anyMatch(test -> test.getAddedTest().getId().equals(potentialReflexTest.getId())
&& applyNumericRelationRulesForReflex(test, potentialTriggerResult));
}

private boolean doesGenericRulesForReflexApply(Test potentialReflexTest, Result potentialTriggerResult) {
List<TestReflex> reflexesForResult = reflexResolver.getTestReflexesForResult(potentialTriggerResult);
return reflexesForResult.stream().anyMatch(test -> test.getAddedTest().equals(potentialReflexTest)
return reflexesForResult.stream().anyMatch(test -> test.getAddedTest().getId().equals(potentialReflexTest.getId())
&& applyTextRelationRulesForReflex(test, potentialTriggerResult));
}
}

0 comments on commit 2ced6c1

Please sign in to comment.