Skip to content

Commit

Permalink
fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Lai committed Sep 25, 2024
1 parent c71fa52 commit d586273
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ private List<CustomSampleIdentifier> extractCustomDataSamplesWithoutSession(fina

MultiKeyMap<String, String> customDataByStudySampleName = new MultiKeyMap<>();

studyViewFilter.getCustomDataFilters().stream().forEach(filter -> {
studyViewFilter.getCustomDataFilters().stream().forEach(filter ->
filter.getSamples().forEach(datum -> {
String value = datum.getValue().toUpperCase();
if (value.equals("NAN") || value.equals("N/A")) {
value = "NA";
}
customDataByStudySampleName.put(datum.getStudyId(), datum.getSampleId(), filter.getDisplayName(), value);
});
});
})
);

List<CustomSampleIdentifier> filtered = new ArrayList<>();
customSampleIdentifiers.forEach(customSampleIdentifier -> {
Expand Down Expand Up @@ -249,23 +249,21 @@ private Integer getFilteredCountByDataIntervalWithStudySampleNameMap(List<Clinic
List<Range<BigDecimal>> ranges = filter.getValues().stream()
.map(this::calculateRangeValueForFilter)
.filter(Objects::nonNull)
.collect(Collectors.toList());
.toList();

// find special value filters
List<String> specialValues = filter.getValues().stream()
.filter(f -> f.getValue() != null)
.map(f -> f.getValue().toUpperCase())
.collect(Collectors.toList());
.toList();

if (rangeValue != null) {
if (ranges.stream().anyMatch(r -> r.encloses(rangeValue))) {
count++;
}
if (rangeValue != null && ranges.stream().anyMatch(r -> r.encloses(rangeValue))) {
count++;
}
else if (specialValues.contains(attrValue.toUpperCase())) {
count++;
}
} else if (containsNA(filter)) {
} else if (Boolean.TRUE.equals(containsNA(filter))) {
count++;
}
}
Expand Down

0 comments on commit d586273

Please sign in to comment.