We are facing the issue of “wrong sorted items” in dhis2 instances that are running for a long time.
Environment: dhis2 instance running for a long time (several upgrades perfomed) and currently on version 40.4.1
Case: a GET
request to api/visualizations?paging=false
endpoint returns 500
(the message could appear or not).
{
httpStatus: "Internal Server Error",
httpStatusCode: 500,
status: "ERROR",
message: "Cannot invoke "org.hisp.dhis.organisationunit.OrganisationUnit.getUid()" because "organisationUnit" is null"
}
Reason: There are visualizations with an unexpected order in the table visualization_organisationunits
. The expected values of the sort_order
are 0,1,2,3,4...
.
The two main rules are:
- After ordering, first
sort_order
value MUST be0
- There MUST NOT be gaps between sort_order values (like
0,2,3,4
where1
is missed).
Solution: Run a SQL function created specifically for this issue. You can access it here
Do you have another examples to share ?
1 post - 1 participant