mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixed the incorrect device statistics issue happening due to REMOVED and DELETED devices.
This commit is contained in:
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);
|
||||
@ -206,7 +208,7 @@ public class GroupBasedSubscriptionManagementHelperServiceImpl implements Subscr
|
||||
.map(Device::getId).collect(Collectors.toList());
|
||||
SubscriptionStatisticDTO subscriptionStatisticDTO = subscriptionDAO.
|
||||
getSubscriptionStatistic(deviceIdsOwnByGroup, isUnsubscribe, tenantId, applicationReleaseDTO.getId());
|
||||
int allDeviceCount= deviceIdsOwnByGroup.size();
|
||||
int allDeviceCount = deviceIdsOwnByGroup.size();
|
||||
return SubscriptionManagementHelperUtil.getSubscriptionStatistics(subscriptionStatisticDTO, allDeviceCount);
|
||||
} catch (ApplicationManagementDAOException e) {
|
||||
String msg = "Error encountered while getting subscription statistics for group: " + subscriptionInfo.getIdentifier();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user