fix: /tracker/trackedEntities?order=createdAt DHIS2-15325 [2.39] #14661
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
backport of #14631
Note that < 2.40 we have some extra logic affecting the users
order
param field names. Due to that some field names inTrackedEntityInstanceQueryParams.OrderColumn
refer to old tracker field names.Order field name translation logic
PagingAndSortingCriteria
translates from new tracker field names to old tracker ones. These field names are registered in the criteria classes (calledRequestParam
in master; this translation does not exist >= 2.40).Here is where the new/old tracker names are registered
dhis2-core/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/webrequest/tracker/TrackerTrackedEntityCriteria.java
Lines 147 to 169 in d5afd34
I added a test
webapi/controller/event/webrequest/tracker/TrackerTrackedEntityCriteriaTest.java
to show how the translation works.
order=<fieldname>
in new tracker endpointsFor example
TRACKEDENTITY("trackedEntityInstance", "uid", MAIN_QUERY_ALIAS),
takes the old tracker field name and maps it to the
uid
column. This works for old and new tracker as the new tracker nametrackedEntity
has been translated totrackedEntityInstance
in step 1. 😅