[ 
https://issues.apache.org/jira/browse/FINERACT-2917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Adam Saghy resolved FINERACT-2917.
----------------------------------
    Resolution: Fixed

> Updating meeting attendance changes the wrong meeting and does not save new 
> attendees
> -------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2917
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2917
>             Project: Apache Fineract
>          Issue Type: Bug
>            Reporter: chinmaya samantara
>            Assignee: chinmaya samantara
>            Priority: Major
>             Fix For: 1.16.0
>
>
>  Since FINERACT-2548, updating attendance on an existing meeting (POST 
> /\{entityType}/\{entityId}/meetings/\{meetingId}?command=saveOrUpdateAttendance)
>  has three problems in MeetingAttendanceWriteServiceImpl. The first one 
> silently changes attendance on a different meeting.
> *1. The wrong meeting is updated*
> {code:java}
> var meeting = meetingRepository.findById(request.getEntityId())
> {code}
> {{request.getEntityId()}} is the group or center id from the URL, not the 
> meeting id ({{{}request.getId(){}}}, set from \{meetingId}). So the update is 
> applied to whichever meeting has the same id as the group. The legacy code 
> loaded the meeting by the command's entity id, which was the meeting id.
> Steps to reproduce: group 2 has client 5 and three meetings: id 1 (14 Sep), 
> id 2 (07 Sep, client 5 present), id 3 (21 Sep, no attendance). Mark client 5 
> absent on meeting 3:
> {code:json}
> POST 
> /fineract-provider/api/v1/groups/2/meetings/3?command=saveOrUpdateAttendance
> { "meetingAttendance": [ { "clientId": 5, "attendanceType": { "id": 2 } } ] }
> {code}
> Actual result: HTTP 200 with "entityId": 2. In m_client_attendance, meeting 2 
> (07 Sep) now has client 5 absent; meeting 3 is unchanged. A meeting id that 
> doesn't exist (e.g. /groups/2/meetings/999) is also accepted. When no meeting 
> has the group's id, the error names the wrong id ("Meeting with identifier 10 
> does not exist" for a request to meeting 4 of group 10).
> Expected result: meeting 3 is updated; an unknown meeting id gives 404.
> *2. Newly added attendees are not saved*
> In updateAttendance(), clients who have no attendance on the meeting yet are 
> collected in {{result}} and then added with 
> {{{}clientsAttendance.addAll(result){}}}. That is the local set built from 
> the request, not the meeting's own set 
> ({{{}meeting.getClientsAttendance(){}}}), so they are never persisted. The 
> legacy Meeting.updateAttendance() added them to the meeting's set.
> Steps to reproduce: meeting 3 above has no attendance. Because of problem 1, 
> a URL whose entity id is 3 loads meeting 3:
> {code:json}
> POST 
> /fineract-provider/api/v1/centers/3/meetings/999?command=saveOrUpdateAttendance
> { "meetingAttendance": [ { "clientId": 5, "attendanceType": { "id": 1 } } ] }
> {code}
> Actual result: HTTP 200, and the response reports the change 
> (changes.clientsAttendance contains client 5), but m_client_attendance has no 
> row for meeting 3.
> Expected result: the attendance row is saved.
> *3. The request field was renamed*
> The list in MeetingAttendanceUpdateRequest is called meetingAttendance (and 
> is @Hidden in Swagger). The legacy API, the create request and the response 
> all use clientsAttendance. A request with clientsAttendance gives HTTP 500 on 
> develop.
> *Possible fix:* load the meeting with request.getId() (404 if not found, and 
> check it belongs to the entity in the URL); add new attendees to 
> meeting.getClientsAttendance(); accept clientsAttendance as the field name 
> (or document meetingAttendance); add tests for updating attendance.
> Related: FINERACT-2911 (creating attendance; its fix lets center attendance 
> updates reach problem 1, so these should be fixed together or close together).
> Found on: Fineract develop (7ac7801, local Docker). 
> MeetingAttendanceWriteServiceImpl is unchanged on develop 8bdbff9 
> (2026-10-09); its last change is 912eaf1 (FINERACT-2548).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to