Skip to content

fix: [ANDROSDK-2329] use SELECTED mode for leaf orgunits on download - #2692

Open
vgarciabnz wants to merge 3 commits into
developfrom
ANDROSDK-2329
Open

fix: [ANDROSDK-2329] use SELECTED mode for leaf orgunits on download#2692
vgarciabnz wants to merge 3 commits into
developfrom
ANDROSDK-2329

Conversation

@vgarciabnz

@vgarciabnz vgarciabnz commented Aug 6, 2026

Copy link
Copy Markdown
Member

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.isLeaf flag — already computed when dividing a bundle by org unit — through TrackerDownloadCall, EventDownloadCall, and TrackedEntityInstanceDownloadCall, 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 TrackerQueryCommonParams copy, so it doesn't leak into the bundle-level ouMode used 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

@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant