Skip to content

Commit

Permalink
Adding the changes for removing duplicate in contentList for cbPlan (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahil-tarento authored Jan 18, 2024
1 parent c64b685 commit c19bc01
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/sunbird/cbp/service/CbPlanServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ public SBApiResponse getCBPlanListForUser(String userOrgId, String authTokenOrUs
}
List<Map<String, Object>> resultMap = new ArrayList<>();
Map<String, Object> courseDetailsMap = new HashMap<>();
cbplanResult = cbplanResult.stream().filter(userCbPlan -> (Boolean)userCbPlan.get(Constants.CB_IS_ACTIVE) == true).collect(Collectors.toList());
cbplanResult = cbplanResult.stream().filter(userCbPlan -> (Boolean)userCbPlan.get(Constants.CB_IS_ACTIVE) == true)
.sorted(Comparator.comparing(m -> (Date) ((Map<String, Object>) m).get(Constants.END_DATE)).reversed()).collect(Collectors.toList());
for (Map<String, Object> cbPlan : cbplanResult) {
Map<String, Object> cbPlanDetails = new HashMap<>();
cbPlanDetails.put(Constants.ID, cbPlan.get(Constants.CB_PLAN_ID_KEY));
Expand Down Expand Up @@ -520,7 +521,7 @@ public SBApiResponse getCBPlanListForUser(String userOrgId, String authTokenOrUs
logger.error("Failed to read course details for Id: " + courseId);
}
} else {
contentDetails = (Map<String, Object>) courseDetailsMap.get(courseId);
continue;
}
if (MapUtils.isNotEmpty(contentDetails)) {
courseList.add(contentDetails);
Expand Down

0 comments on commit c19bc01

Please sign in to comment.