Skip to content

Commit 219a0c9

Browse files
Fix results filtering pb when no match has been found (#115)
Signed-off-by: Franck LECUYER <[email protected]>
1 parent 058e708 commit 219a0c9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/org/gridsuite/voltageinit/server/service/VoltageInitService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import com.powsybl.ws.commons.computation.service.NotificationService;
1515
import com.powsybl.ws.commons.computation.service.UuidGeneratorService;
1616
import com.powsybl.ws.commons.computation.utils.FilterUtils;
17-
import org.apache.commons.collections4.CollectionUtils;
1817
import org.gridsuite.voltageinit.server.dto.BusVoltage;
1918
import org.gridsuite.voltageinit.server.dto.ReactiveSlack;
2019
import org.gridsuite.voltageinit.server.dto.VoltageInitResult;
@@ -92,11 +91,11 @@ private static VoltageInitResult fromEntity(VoltageInitResultEntity resultEntity
9291
.sorted(Map.Entry.comparingByKey(String.CASE_INSENSITIVE_ORDER))
9392
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (collisionValue1, collisionValue2) -> collisionValue1, LinkedHashMap::new));
9493
List<ReactiveSlack> reactiveSlacks = resultEntity.getReactiveSlacks().stream()
95-
.filter(slack -> CollectionUtils.isEmpty(voltageLevelIds) || voltageLevelIds.contains(slack.getVoltageLevelId()))
94+
.filter(slack -> voltageLevelIds == null || voltageLevelIds.contains(slack.getVoltageLevelId()))
9695
.map(slack -> new ReactiveSlack(slack.getVoltageLevelId(), slack.getBusId(), slack.getSlack()))
9796
.toList();
9897
List<BusVoltage> busVoltages = resultEntity.getBusVoltages().stream()
99-
.filter(bv -> CollectionUtils.isEmpty(voltageLevelIds) || voltageLevelIds.contains(bv.getVoltageLevelId()))
98+
.filter(bv -> voltageLevelIds == null || voltageLevelIds.contains(bv.getVoltageLevelId()))
10099
.map(bv -> new BusVoltage(bv.getVoltageLevelId(), bv.getBusId(), bv.getV(), bv.getAngle()))
101100
.toList();
102101
return new VoltageInitResult(resultEntity.getResultUuid(), resultEntity.getWriteTimeStamp(), sortedIndicators,

0 commit comments

Comments
 (0)