Skip to content

Commit

Permalink
Fixed error with sorting value for charts
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Jun 23, 2021
1 parent a221160 commit d4d4283
Showing 1 changed file with 26 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private Chart.Builder convertChart(GetChartRequest request) {
chartSeries.put(key, serie);
});
// Add all
chartSeries.keySet().forEach(serie -> {
chartSeries.keySet().stream().sorted().forEach(serie -> {
builder.addSeries(ChartSerie.newBuilder().setName(serie).addAllDataSet(chartSeries.get(serie)));
});
return builder;
Expand Down Expand Up @@ -272,6 +272,31 @@ private ListDashboardsResponse.Builder convertDashboarsList(Properties context,
if(roleId <= 0) {
roleId = RecordUtil.getIdFromUuid(I_AD_Role.Table_Name, request.getRoleUuid(), null);
}
// Get from Charts
new Query(Env.getCtx(), I_PA_Goal.Table_Name,
"((AD_User_ID IS NULL AND AD_Role_ID IS NULL)"
+ " OR AD_Role_ID=?" // #2
+ " OR EXISTS (SELECT 1 FROM AD_User_Roles ur "
+ "WHERE ur.AD_User_ID=PA_Goal.AD_User_ID AND ur.AD_Role_ID = ? AND ur.IsActive='Y')) ", null)
.setParameters(roleId, roleId)
.setOnlyActiveRecords(true)
.setClient_ID()
.setOrderBy(I_PA_Goal.COLUMNNAME_SeqNo)
.<MGoal>list()
.forEach(chartDefinition -> {
Dashboard.Builder dashboardBuilder = Dashboard.newBuilder();
dashboardBuilder.setId(chartDefinition.getPA_Goal_ID());
dashboardBuilder.setUuid(ValueUtil.validateNull(chartDefinition.getUUID()));
dashboardBuilder.setName(ValueUtil.validateNull(chartDefinition.getName()));
dashboardBuilder.setDescription(ValueUtil.validateNull(chartDefinition.getDescription()));
dashboardBuilder.setDashboardType("chart");
dashboardBuilder.setChartType(ValueUtil.validateNull(chartDefinition.getChartType()));
dashboardBuilder.setIsCollapsible(true);
dashboardBuilder.setIsOpenByDefault(true);
// Add to builder
builder.addDashboards(dashboardBuilder);
});
// Get from activity
new Query(context, I_PA_DashboardContent.Table_Name,
"EXISTS(SELECT 1 FROM AD_Dashboard_Access da WHERE da.PA_DashboardContent_ID = PA_DashboardContent.PA_DashboardContent_ID AND da.AD_Role_ID = ?)", null)
.setParameters(roleId)
Expand Down Expand Up @@ -319,29 +344,6 @@ private ListDashboardsResponse.Builder convertDashboarsList(Properties context,
}
builder.addDashboards(dashboardBuilder);
});
// Get from util
new Query(Env.getCtx(), I_PA_Goal.Table_Name,
"((AD_User_ID IS NULL AND AD_Role_ID IS NULL)"
+ " OR AD_Role_ID=?" // #2
+ " OR EXISTS (SELECT 1 FROM AD_User_Roles ur "
+ "WHERE ur.AD_User_ID=PA_Goal.AD_User_ID AND ur.AD_Role_ID = ? AND ur.IsActive='Y')) ", null)
.setParameters(roleId, roleId)
.setOnlyActiveRecords(true)
.setClient_ID()
.setOrderBy(I_PA_Goal.COLUMNNAME_SeqNo)
.<MGoal>list()
.forEach(chartDefinition -> {
Dashboard.Builder dashboardBuilder = Dashboard.newBuilder();
dashboardBuilder.setId(chartDefinition.getPA_Goal_ID());
dashboardBuilder.setUuid(ValueUtil.validateNull(chartDefinition.getUUID()));
dashboardBuilder.setName(ValueUtil.validateNull(chartDefinition.getName()));
dashboardBuilder.setDescription(ValueUtil.validateNull(chartDefinition.getDescription()));
dashboardBuilder.setLineNo(chartDefinition.getSeqNo());
dashboardBuilder.setDashboardType("chart");
dashboardBuilder.setChartType(ValueUtil.validateNull(chartDefinition.getChartType()));
// Add to builder
builder.addDashboards(dashboardBuilder);
});
// Return
return builder;
}
Expand Down

0 comments on commit d4d4283

Please sign in to comment.