Fixed the incorrect device statistics issue happening due to REMOVED and DELETED devices.

remotes/1727692234363924000/master
Ruwin Dissanayake 3 months ago
parent 2da8cdd05f
commit 6934827920

@ -196,8 +196,10 @@ public class GroupBasedSubscriptionManagementHelperServiceImpl implements Subscr
List<Device> devices = HelperUtil.getGroupManagementProviderService().
getAllDevicesOfGroup(subscriptionInfo.getIdentifier(), false);
List<Integer> removedIds = devices.stream()
.filter(device -> {String status = String.valueOf(device.getEnrolmentInfo().getStatus());
return "REMOVED".equalsIgnoreCase(status) || "DELETED".equalsIgnoreCase(status);})
.filter(device -> {
String status = String.valueOf(device.getEnrolmentInfo().getStatus());
return "REMOVED".equalsIgnoreCase(status) || "DELETED".equalsIgnoreCase(status);
})
.map(device -> device.getEnrolmentInfo().getId()).collect(Collectors.toList());
List<Integer> enrollmentIdsOwnByGroup = devices.stream().map(device -> device.getEnrolmentInfo().getId()).collect(Collectors.toList());
enrollmentIdsOwnByGroup.removeAll(removedIds);

Loading…
Cancel
Save