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

akhilesh chekare commented on FINERACT-1556:
--------------------------------------------

[~adamsaghy] 

{*}Investigation & Fix Details{*}{*}{*}

*Root Cause:* When running Stretchy Reports (e.g., "Client Listing"), the 
reporting engine was throwing a 500 Internal Server Error when required SQL 
parameters (like ${officeId}) were missing from the request. The API was not 
gracefully handling missing placeholders during the SQL query construction, 
causing the underlying reporting logic to completely crash.

{*}Solution Provided:{*}{*}{*}
 # *Implemented Fallback Logic for* officeId{*}:{*} Updated 
ReadReportingServiceImpl so that if the ${officeId} parameter is omitted from 
the request, the engine now gracefully auto-resolves and defaults to the 
officeId of the currently authenticated user.
 # *Standardized API Validation Errors:* Modified the parameter mapping logic 
so that if _other_ required parameters are missing, it now properly throws a 
PlatformApiDataValidationException. This correctly returns a 400 Bad Request 
with an ApiParameterError payload to the client, rather than crashing with a 
500 server error.
 # *Unit Test Coverage:* Created ReadReportingServiceImplTest.java to 
explicitly test and guarantee that missing parameters throw validation 
exceptions and that the officeId successfully auto-resolves.

{*}Testing Performed:{*}{*}{*}
 * Validated via curl (/runreports/Client%20Listing) that omitting officeId 
correctly returns results scoped to the user's office.
 * Validated that omitting other parameters correctly returns a 400 Bad Request 
payload.


*PR link:* https://github.com/apache/fineract/pull/6061

>  Stretchy Reports Are Not Working With Postgres
> -----------------------------------------------
>
>                 Key: FINERACT-1556
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1556
>             Project: Apache Fineract
>          Issue Type: Bug
>            Reporter: Shemin Anto
>            Priority: Minor
>              Labels: beginner-friendly, postgres
>         Attachments: image-2022-03-30-12-24-59-814.png, 
> image-2022-03-30-12-25-07-774.png
>
>
> !image-2022-03-30-12-24-59-814.png|width=439,height=160!
> !image-2022-03-30-12-25-07-774.png|width=431,height=124!
> Showing Error when a particular report is opened



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

Reply via email to