Skip to content

Commit

Permalink
MAT-8277 changes as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-cecilialiu committed Mar 3, 2025
1 parent 8fa6704 commit 511b48b
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cms.gov.madie.measure.utils;

import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.collections4.CollectionUtils;

Expand All @@ -23,16 +22,16 @@ public static void setGroupAndPopulationsDisplayIds(Measure measure, Group group

// set population display id
if (!CollectionUtils.isEmpty(group.getPopulations())) {
List<Population> ips =
boolean hasMultipleIps =
group.getPopulations().stream()
.filter(pop -> pop.getName().equals(PopulationType.INITIAL_POPULATION))
.collect(Collectors.toList());
.filter(pop -> pop.getName().equals(PopulationType.INITIAL_POPULATION))
.count()
> 1;

for (int index = 0; index < group.getPopulations().size(); index++) {
Population population = group.getPopulations().get(index);
String popDisplayId =
getPopulationDisplayId(
population, groupNumber, (!CollectionUtils.isEmpty(ips) && ips.size() > 1), index);
getPopulationDisplayId(population, groupNumber, hasMultipleIps, index);
population.setDisplayId(popDisplayId);
}
}
Expand All @@ -51,8 +50,7 @@ static int getGroupNumber(Group group, List<Group> groups) {

static String getPopulationDisplayId(
Population population, String groupNumber, boolean multipleIps, int index) {
String newPopDisplayId = null;
newPopDisplayId = population.getName().getDisplay().replace(" ", "") + "_" + groupNumber;
String newPopDisplayId = population.getName().getDisplay().replace(" ", "") + "_" + groupNumber;
if (multipleIps && (index == 0 || index == 1)) {
newPopDisplayId = newPopDisplayId + "_" + (index + 1);
}
Expand Down

0 comments on commit 511b48b

Please sign in to comment.