adamsaghy commented on code in PR #4549:
URL: https://github.com/apache/fineract/pull/4549#discussion_r2034902873


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java:
##########
@@ -87,26 +83,23 @@ public class CalendarsApiResource {
     @Path("{calendarId}")
     @Consumes({ MediaType.APPLICATION_JSON })
     @Produces({ MediaType.APPLICATION_JSON })
-    public String retrieveCalendar(@PathParam("calendarId") final Long 
calendarId, @PathParam("entityType") final String entityType,
+    public CalendarData retrieveCalendar(@PathParam("calendarId") final Long 
calendarId, @PathParam("entityType") final String entityType,
             @PathParam("entityId") final Long entityId, @Context final UriInfo 
uriInfo) {
 
-        
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
+        
context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
         final Integer entityTypeId = 
CalendarEntityType.valueOf(entityType.toUpperCase()).getValue();
-        CalendarData calendarData = 
this.readPlatformService.retrieveCalendar(calendarId, entityId, entityTypeId);
+        final ApiRequestJsonSerializationSettings settings = 
apiRequestParameterHelper.process(uriInfo.getQueryParameters());
 
-        // Include recurring date details
-        final boolean withHistory = true;
-        final LocalDate tillDate = null;
-        final Collection<LocalDate> recurringDates = 
this.readPlatformService.generateRecurringDates(calendarData, withHistory, 
tillDate);
-        final Collection<LocalDate> nextTenRecurringDates = 
this.readPlatformService.generateNextTenRecurringDates(calendarData);
-        final LocalDate recentEligibleMeetingDate = null;
-        calendarData = CalendarData.withRecurringDates(calendarData, 
recurringDates, nextTenRecurringDates, recentEligibleMeetingDate);
+        final CalendarData calendarData = 
readPlatformService.retrieveCalendar(calendarId, entityId, entityTypeId);
+        final Collection<LocalDate> recurringDates = 
readPlatformService.generateRecurringDates(calendarData, true, null);
+        final Collection<LocalDate> nextTenRecurringDates = 
readPlatformService.generateNextTenRecurringDates(calendarData);
+        calendarData.setRecurringDates(recurringDates);
+        calendarData.setNextTenRecurringDates(nextTenRecurringDates);
 
-        final ApiRequestJsonSerializationSettings settings = 
this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
         if (settings.isTemplate()) {
-            calendarData = handleTemplate(calendarData);
+            handleTemplate(calendarData);

Review Comment:
   I meant the following:
   handleTemplate has an incoming parameter which is the `calendarData`. 
   
   The handleTemplate method creates a new object and add additional values and 
return a new `calendarData` we should return as result this new object, not the 
old one...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to