From 84f596745c35ddfaf4c365b30ba93804720f448c Mon Sep 17 00:00:00 2001 From: saipradeep_ravipati Date: Wed, 3 Jan 2024 08:01:40 +0530 Subject: [PATCH] Karma Points Course API Changes to return single record instead List --- .../karmapoints/service/KarmaPointsServiceImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/sunbird/karmapoints/service/KarmaPointsServiceImpl.java b/src/main/java/org/sunbird/karmapoints/service/KarmaPointsServiceImpl.java index 680bb25c2..7aa5fc692 100644 --- a/src/main/java/org/sunbird/karmapoints/service/KarmaPointsServiceImpl.java +++ b/src/main/java/org/sunbird/karmapoints/service/KarmaPointsServiceImpl.java @@ -82,9 +82,12 @@ public Map fetchKarmaPointsUserCourse(String userId, Map userKpList = cassandraOperation.getRecordsByProperties(Constants.KEYSPACE_SUNBIRD, - Constants.TABLE_KARMA_POINTS, whereMap, null, Constants.USER_ID_CONSTANT); - resultMap.put(Constants.KARMA_POINTS_LIST, userKpList); + List> userKpList = cassandraOperation.getRecordsByProperties(Constants.KEYSPACE_SUNBIRD, + Constants.TABLE_KARMA_POINTS, whereMap, null); + Map result = new HashMap<>(); + if(userKpList !=null && !userKpList.isEmpty()) + result = userKpList.get(0); + resultMap.put(Constants.KARMA_POINTS_LIST, result); return resultMap; } public void claimKarmaPoints(ClaimKarmaPointsRequest request) {