[ 
https://issues.apache.org/jira/browse/FINERACT-2558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18069026#comment-18069026
 ] 

Sandro Martínez Pérez edited comment on FINERACT-2558 at 3/27/26 3:30 PM:
--------------------------------------------------------------------------

Hey [~hhxj], can I implement this fix?


was (Author: JIRAUSER312858):
Hola [~hhxj], ¿puedo implementar esta solución?

> Duplicate gender update block in client update flow causes redundant lookup 
> and assignment
> ------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2558
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2558
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 1.14.0
>            Reporter: HuangXi
>            Priority: Major
>              Labels: performance
>         Attachments: image-2026-03-27-19-52-13-369.png
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> h1. Duplicate gender update execution in client update flow
> h2. Problem
> In the client update flow, gender update logic is executed twice when 
> genderId is changed.
> This causes redundant code-value lookup and duplicate setter invocation with 
> the same value.
> !image-2026-03-27-19-52-13-369.png!
> h2. Call Flow
> API receives update request in ClientsApiResource.java:522
> Command routed to update handler UpdateClientCommandHandler.java:45
> Business logic executed in 
> ClientWritePlatformServiceJpaRepositoryImpl.java:407
> Evidence
> Change detection for genderId is added once at 
> ClientWritePlatformServiceJpaRepositoryImpl.java:479
> First gender update block at 
> ClientWritePlatformServiceJpaRepositoryImpl.java:566
> Second gender update block at 
> ClientWritePlatformServiceJpaRepositoryImpl.java:588
> The domain method only performs plain assignment at Client.java:649
> Actual Behavior
> When genderId changes, both gender update blocks run in the same request.
> h2. Expected Behavior
> Gender should be resolved and assigned exactly once per request.
> h2. Impact
> Redundant repository lookup and duplicate setter call
> Reduced code clarity and higher maintenance cost
> No functional gain, no intended special behavior observed
> h2. Root Cause
> Likely historical duplication during earlier feature extension 
> (clientType/clientClassification block introduction), leaving an older gender 
> block in place.
> h2. Proposed Fix
> Remove one duplicate gender update block in updateClient and keep a single 
> canonical gender update section.
> h2. Acceptance Criteria
> genderId update path executes exactly one gender resolution and one 
> updateGender call
> Existing behavior for staffId, savingsProductId, clientTypeId, and 
> clientClassificationId remains unchanged
> Client update tests pass without regression



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

Reply via email to