From e6954280c085fd5570567a4892f944abf3b54505 Mon Sep 17 00:00:00 2001 From: vikrantbipin <118338417+vikrantbipin@users.noreply.github.com> Date: Tue, 13 Feb 2024 11:23:16 +0530 Subject: [PATCH] Exception handling of the enrolment list API (#134) * Added two parameters in course enrolment email notification * Added two parameters in course enrolment email notification * Added two parameters in course enrolment email notification * Added two parameters in course enrolment email notification * Exception handling of the enrolment list API --- .../enrolments/CourseEnrolmentActor.scala | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/course-mw/enrolment-actor/src/main/scala/org/sunbird/enrolments/CourseEnrolmentActor.scala b/course-mw/enrolment-actor/src/main/scala/org/sunbird/enrolments/CourseEnrolmentActor.scala index b0b602a4c..85091fd7a 100644 --- a/course-mw/enrolment-actor/src/main/scala/org/sunbird/enrolments/CourseEnrolmentActor.scala +++ b/course-mw/enrolment-actor/src/main/scala/org/sunbird/enrolments/CourseEnrolmentActor.scala @@ -447,30 +447,31 @@ class CourseEnrolmentActor @Inject()(@Named("course-batch-notification-actor") c } val allEnrolledCourses = new java.util.ArrayList[java.util.Map[String, AnyRef]] val version = request.getContext.get("version") - if(version.equals("v1")) { - if(CollectionUtils.isNotEmpty(courseIds)){ - val enrolmentList: java.util.List[java.util.Map[String, AnyRef]] = addCourseDetails(activeEnrolments, courseIds, request, false) + if ("v2".equals(version)) { + val enrolmentList: java.util.List[java.util.Map[String, AnyRef]] = addCourseDetails_v2(activeEnrolments) if (enrolmentList != null) { allEnrolledCourses.addAll(enrolmentList) } } - if(CollectionUtils.isNotEmpty(secureCourseIds)){ - val secureCourseEnrolmentList: java.util.List[java.util.Map[String, AnyRef]] = addCourseDetails(activeEnrolments, secureCourseIds, request, true) - if (secureCourseEnrolmentList != null) { - allEnrolledCourses.addAll(secureCourseEnrolmentList) - } - } - } else { - val enrolmentList: java.util.List[java.util.Map[String, AnyRef]] = addCourseDetails_v2(activeEnrolments) - if (enrolmentList != null) { - allEnrolledCourses.addAll(enrolmentList) + if (CollectionUtils.isNotEmpty(courseIds)) { + val enrolmentList: java.util.List[java.util.Map[String, AnyRef]] = addCourseDetails(activeEnrolments, courseIds, request, false) + if (enrolmentList != null) { + allEnrolledCourses.addAll(enrolmentList) + } + } + if (CollectionUtils.isNotEmpty(secureCourseIds)) { + val secureCourseEnrolmentList: java.util.List[java.util.Map[String, AnyRef]] = addCourseDetails(activeEnrolments, secureCourseIds, request, true) + if (secureCourseEnrolmentList != null) { + allEnrolledCourses.addAll(secureCourseEnrolmentList) + } } } val updatedEnrolmentList = updateProgressData(allEnrolledCourses, userId, allCourseIds, request.getRequestContext) - if(version.equals("v1")) - addBatchDetails(updatedEnrolmentList, request) - else addBatchDetails_v2(updatedEnrolmentList, request) + if ("v2".equals(version)) + addBatchDetails_v2(updatedEnrolmentList, request) + else + addBatchDetails(updatedEnrolmentList, request) } else new java.util.ArrayList[java.util.Map[String, AnyRef]]() }