Skip to content

Commit

Permalink
Defect Fixing- CBP Portal certificate tab learner details missing iss…
Browse files Browse the repository at this point in the history
…ue (#152)

* Prod Fixes for cbp learner progress issue
  • Loading branch information
sreeragksgh authored Nov 17, 2022
1 parent 886f0d0 commit 94ff851
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public Map<String, Object> searchLiveContent(String contentId) {
Map<String, Object> contentRequestValue = new HashMap<>();
contentRequestValue.put(Constants.FILTERS, filters);
contentRequestValue.put(Constants.FIELDS,
Arrays.asList(Constants.IDENTIFIER, Constants.NAME, Constants.PRIMARY_CATEGORY, Constants.BATCHES));
Arrays.asList(Constants.IDENTIFIER, Constants.NAME, Constants.PRIMARY_CATEGORY, Constants.BATCHES, Constants.LEAF_NODES_COUNT));
Map<String, Object> contentRequest = new HashMap<>();
contentRequest.put(Constants.REQUEST, contentRequestValue);
response = outboundRequestHandlerService.fetchResultUsingPost(
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/sunbird/common/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ public class Constants {
public static final String CONTENT_TYPE_SEARCH = "contentType";
public static final String NEW_COURSES = "newcourses";
public static final String OVERVIEW_BATCH_KEY = "/overview?batchId=";
public static final String LEAF_NODES_COUNT = "leafNodesCount";

private Constants() {
throw new IllegalStateException("Utility class");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,16 @@ public Map<String, Object> getUserProgress(SunbirdApiRequest requestBody, String
// set completion percentage & status
String courseId = (String) responseObj.get(Constants.COURSE_ID);
if (!courseLeafCount.containsKey(courseId)) {
SunbirdApiResp contentResponse = contentService.getHeirarchyResponse(courseId);
courseLeafCount.put(courseId, contentResponse.getResult().getContent().getLeafNodesCount());
Map<String, Object> contentResponse = contentService.searchLiveContent(courseId);
if (!ObjectUtils.isEmpty(contentResponse)) {
Map<String, Object> contentResult = (Map<String, Object>) contentResponse.get(Constants.RESULT);
if (0 < (Integer) contentResult.get(Constants.COUNT)) {
List<Map<String, Object>> contentList = (List<Map<String, Object>>) contentResult
.get(Constants.CONTENT);
Map<String, Object> content = contentList.get(0);
courseLeafCount.put(courseId, (Integer) content.get(Constants.LEAF_NODES_COUNT));
}
}
}
setCourseCompletiondetails(responseObj, courseLeafCount.get(courseId));
}
Expand Down

0 comments on commit 94ff851

Please sign in to comment.