diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/coursebatch/dao/impl/CourseBatchDaoImpl.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/coursebatch/dao/impl/CourseBatchDaoImpl.java index 57a3e868d..1e7677f25 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/coursebatch/dao/impl/CourseBatchDaoImpl.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/coursebatch/dao/impl/CourseBatchDaoImpl.java @@ -42,12 +42,14 @@ public Response create(RequestContext requestContext, CourseBatch courseBatch) { String timeType=JsonKey.START_TIME; processStartEndDate(map, timeType, dateType); map.remove(JsonKey.START_TIME); + courseBatch.setStartDate((Date)map.get(dateType)); } if(map.get(JsonKey.END_TIME) != null) { String dateType=JsonKey.END_DATE_BATCH; String timeType=JsonKey.END_TIME; processStartEndDate(map, timeType, dateType); map.remove(JsonKey.END_TIME); + courseBatch.setEndDate((Date)map.get(dateType)); } return cassandraOperation.insertRecord( requestContext, courseBatchDb.getKeySpace(), courseBatchDb.getTableName(), map); diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchUtil.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchUtil.java index 1650a4b95..4be4a8213 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchUtil.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/util/CourseBatchUtil.java @@ -185,6 +185,10 @@ public static Map esCourseMapping(CourseBatch courseBatch, Strin dateFormat.setTimeZone(TimeZone.getTimeZone(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_TIMEZONE))); dateTimeFormat.setTimeZone(TimeZone.getTimeZone(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_TIMEZONE))); Map esCourseMap = mapper.convertValue(courseBatch, Map.class); + if (courseBatch.getStartTime() != null && courseBatch.getEndTime() != null) { + esCourseMap.put("startTime", courseBatch.getStartDate()); + esCourseMap.put("endTime", courseBatch.getEndDate()); + } changeInDateFormat.forEach(key -> { if (null != esCourseMap.get(key)) esCourseMap.put(key, dateTimeFormat.format(esCourseMap.get(key))); diff --git a/course-mw/course-actors/src/main/java/org/sunbird/learner/actors/coursebatch/CourseBatchManagementActor.java b/course-mw/course-actors/src/main/java/org/sunbird/learner/actors/coursebatch/CourseBatchManagementActor.java index 61843a97c..656cd3c6a 100644 --- a/course-mw/course-actors/src/main/java/org/sunbird/learner/actors/coursebatch/CourseBatchManagementActor.java +++ b/course-mw/course-actors/src/main/java/org/sunbird/learner/actors/coursebatch/CourseBatchManagementActor.java @@ -722,6 +722,8 @@ private void updateCollection(RequestContext requestContext, Map data.put("createdFor", courseBatch.getOrDefault(JsonKey.COURSE_CREATED_FOR, new ArrayList<>())); data.put("startDate", courseBatch.getOrDefault(JsonKey.START_DATE, "")); data.put("endDate", courseBatch.getOrDefault(JsonKey.END_DATE, null)); + data.put("startTime", courseBatch.getOrDefault("startTime", null)); + data.put("endTime", courseBatch.getOrDefault("endTime", null)); data.put("enrollmentType", courseBatch.getOrDefault(JsonKey.ENROLLMENT_TYPE, "")); data.put("status", courseBatch.getOrDefault(JsonKey.STATUS, "")); data.put("batchAttributes", courseBatch.getOrDefault(CourseJsonKey.BATCH_ATTRIBUTES, new HashMap()));