fix: [ANDROSDK-2329] use SELECTED mode for leaf orgunits on download - #2692
Open
vgarciabnz wants to merge 3 commits into
Open
fix: [ANDROSDK-2329] use SELECTED mode for leaf orgunits on download#2692vgarciabnz wants to merge 3 commits into
vgarciabnz wants to merge 3 commits into
Conversation
vgarciabnz
force-pushed
the
ANDROSDK-2329
branch
from
August 6, 2026 12:27
28e43d8 to
90f6bfc
Compare
vgarciabnz
force-pushed
the
ANDROSDK-2329
branch
from
August 6, 2026 12:55
90f6bfc to
7025ce2
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



The tracker download flow (shared by events and tracked entity instances) queries the DHIS2 API per org unit using an org unit mode such as DESCENDANTS or SELECTED, chosen once for the whole download bundle. For org units known to have no children (leaves), requesting DESCENDANTS or CHILDREN returns the same result as SELECTED, but forces the server to resolve the sub-hierarchy unnecessarily. This PR threads the
DownloadOrgunit.isLeafflag — already computed when dividing a bundle by org unit — throughTrackerDownloadCall,EventDownloadCall, andTrackedEntityInstanceDownloadCall, and uses it to override the org unit mode of each per-org-unit request to SELECTED whenever the target org unit is a leaf.The override is scoped to the single API request via a
TrackerQueryCommonParamscopy, so it doesn't leak into the bundle-levelouModeused elsewhere. Only DESCENDANTS and CHILDREN are eligible for the SELECTED substitution; ACCESSIBLE and other modes are left untouched since they don't depend on the org unit's position in the hierarchy.Related task: ANDROSDK-2329