Remove group varaible

group-11461
osh.silva 4 months ago
parent 2dbecc106b
commit f8c3cacf38

@ -2502,11 +2502,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
}
try {
Connection conn = this.getDBConnection();
String sql = "SELECT COUNT(*) FROM AP_DEVICE_SUBSCRIPTION WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ? AND STATUS = ?";
String sql = "SELECT COUNT(*) FROM AP_DEVICE_SUBSCRIPTION WHERE AP_APP_RELEASE_ID = ? AND TENANT_ID = ? AND STATUS = ? AND ACTION_TRIGGERED_FROM = ?";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId);
ps.setString(3, actionStatus);
ps.setString(4, actionTriggeredFrom);
try (ResultSet rs = ps.executeQuery()) {
if (rs.next()) {
return rs.getInt(1);

@ -1878,7 +1878,6 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
}
List<DeviceSubscriptionData> requestedDevices = new ArrayList<>();
String actionTriggeredFrom = "group";
int installedCount;
int pendingCount;
int errorCount;
@ -1891,32 +1890,32 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
switch (request.getTabActionStatus()) {
case "COMPLETED":
requestedDevices = installedDevices;
installedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), actionTriggeredFrom);
installedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), request.getActionType());
break;
case "PENDING":
requestedDevices = pendingDevices;
pendingCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), actionTriggeredFrom);
pendingCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), request.getActionType());
break;
case "ERROR":
requestedDevices = errorDevices;
errorCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), actionTriggeredFrom);
errorCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), request.getActionType());
break;
case "NEW":
requestedDevices = newDevices;
break;
case "SUBSCRIBED":
requestedDevices = subscribedDevices;
subscribedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), actionTriggeredFrom);
subscribedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, request.getTabActionStatus(), request.getActionType());
break;
}
groupDetailDTO.setDevices(new CategorizedSubscriptionResult(requestedDevices, request.getTabActionStatus()));
} else {
CategorizedSubscriptionResult categorizedSubscriptionResult;
installedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "COMPLETED", actionTriggeredFrom);
pendingCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "PENDING", actionTriggeredFrom);
errorCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "ERROR", actionTriggeredFrom);
subscribedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "SUBSCRIBED", actionTriggeredFrom);
installedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "COMPLETED", request.getActionType());
pendingCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "PENDING", request.getActionType());
errorCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "ERROR", request.getActionType());
subscribedCount = subscriptionDAO.countSubscriptionsByStatus(appReleaseId, tenantId, "SUBSCRIBED", request.getActionType());
newCount = totalDeviceCount - (installedCount + pendingCount + errorCount + subscribedCount);
List<DeviceSubscriptionData> paginatedInstalledDevices = installedDevices.stream()

Loading…
Cancel
Save