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 { try {
Connection conn = this.getDBConnection(); 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)) { try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setInt(1, appReleaseId); ps.setInt(1, appReleaseId);
ps.setInt(2, tenantId); ps.setInt(2, tenantId);
ps.setString(3, actionStatus); ps.setString(3, actionStatus);
ps.setString(4, actionTriggeredFrom);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
if (rs.next()) { if (rs.next()) {
return rs.getInt(1); return rs.getInt(1);

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

Loading…
Cancel
Save