Skip to content

Commit

Permalink
Merge pull request #153 from tarentomaheshvakkund/4.816-batchScheduling
Browse files Browse the repository at this point in the history
KB-5718 | DEV|Assessment |BE| Capturing the starttime and endtime of the Batches while creating the batch for Assessment
  • Loading branch information
SaipradeepR authored Jul 8, 2024
2 parents 32a0d23 + 7c89a61 commit dc01c16
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ public static Map<String, Object> esCourseMapping(CourseBatch courseBatch, Strin
dateFormat.setTimeZone(TimeZone.getTimeZone(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_TIMEZONE)));
dateTimeFormat.setTimeZone(TimeZone.getTimeZone(ProjectUtil.getConfigValue(JsonKey.SUNBIRD_TIMEZONE)));
Map<String, Object> 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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ private void updateCollection(RequestContext requestContext, Map<String, Object>
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<String, Object>()));
Expand Down

0 comments on commit dc01c16

Please sign in to comment.