From 5aaa156f0c6a90001bcebf5d7b3b57779eb2028e Mon Sep 17 00:00:00 2001 From: somvitbhowmik <38094153+somvitbhowmik@users.noreply.github.com> Date: Fri, 2 Dec 2022 12:38:51 +0530 Subject: [PATCH] updated code to fetch the batch list from search api (#159) --- .../assessment/service/CohortsServiceImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/sunbird/assessment/service/CohortsServiceImpl.java b/src/main/java/org/sunbird/assessment/service/CohortsServiceImpl.java index fbb0a5c96..9ef144807 100644 --- a/src/main/java/org/sunbird/assessment/service/CohortsServiceImpl.java +++ b/src/main/java/org/sunbird/assessment/service/CohortsServiceImpl.java @@ -140,10 +140,14 @@ public List getActiveUsers(String xAuthUser, String rootOrg, String // if (!userUtilService.validateUser(rootOrg, userId)) { // throw new BadRequestException("Invalid UserId."); // } - - List batchIdList = fetchBatchIdDetails(contentId); - if (CollectionUtils.isEmpty(batchIdList)) { - return Collections.emptyList(); + List batchIdList = null; + List batches = fetchBatchDetails(contentId); + if (!CollectionUtils.isEmpty(batches)) { + batchIdList = batches.stream().map(SunbirdApiBatchResp::getBatchId).collect(Collectors.toList()); + //List batchIdList = fetchBatchIdDetails(contentId); + if (CollectionUtils.isEmpty(batchIdList)) { + return Collections.emptyList(); + } } return fetchParticipantsList(xAuthUser, rootOrg, batchIdList, count); }