From a92dc3fa943bcc5517848705646b1c91f1d79e26 Mon Sep 17 00:00:00 2001 From: osh Date: Mon, 23 Oct 2023 10:53:28 +0530 Subject: [PATCH] Add fix for usage load performance --- .../mgt/core/service/DeviceManagementProviderServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index ea61d118f7..60750b454f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -1093,10 +1093,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } public double generateCost(List allDevices, Timestamp startDate, Timestamp endDate, Cost tenantCost, List deviceStatusNotAvailable, double totalCost) throws DeviceManagementException { + List deviceStatus; for (Device device : allDevices) { long dateDiff = 0; - device.setDeviceStatusInfo(getDeviceStatusHistory(device, null, endDate, true)); - List deviceStatus = device.getDeviceStatusInfo(); + deviceStatus = getDeviceStatusHistory(device, null, endDate, true); if (device.getEnrolmentInfo().getDateOfEnrolment() < startDate.getTime()) { if (!deviceStatus.isEmpty() && (String.valueOf(deviceStatus.get(0).getStatus()).equals("REMOVED") || String.valueOf(deviceStatus.get(0).getStatus()).equals("DELETED"))) {