fix: resolve OUG{} indicator count to zero when org unit has no group members [2.40]#24278
Open
jason-p-pickering wants to merge 1 commit into
Open
fix: resolve OUG{} indicator count to zero when org unit has no group members [2.40]#24278jason-p-pickering wants to merge 1 commit into
jason-p-pickering wants to merge 1 commit into
Conversation
… members [2.40] Backport of master commit 24aa365 (PR #24266) onto 2.40; equivalent to the 2.41 backport in PR #24271. ItemOrgUnitGroupCount.evaluate() threw a ParserExceptionWithoutContext ("Can't find count for organisation unit ...") whenever the orgUnitCountMap had no entry for the org unit being evaluated. That happens legitimately for an organisation unit whose subtree contains no members of the group: the analytics org unit target aggregation returns no row, so DataHandler passes a null (or entry-less) orgUnitCountMap down to expression evaluation. The count should resolve to 0 in that case rather than throwing. Now reads the map defensively and returns 0d when the map is null or the entry is absent. New ExpressionService2Test case covers both the null-map and missing-entry paths (12 * 0 = 0 via expressionH). This is independent of and complementary to the OUG{} count-query performance work already on the branch (substituteIndicatorExpressions path); this fix is in the analytics indicator-evaluation path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
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.



Summary
Backport of master commit
24aa365fe5(PR #24266) onto2.40— the same fix that PR #24271 backports to2.41.ItemOrgUnitGroupCount.evaluate()threwParserExceptionWithoutContext("Can't find count for organisation unit …")wheneverorgUnitCountMaphad no entry for the org unit being evaluated. That happens legitimately when an org unit's subtree contains no members of the group: the analytics org-unit target aggregation returns no row, soDataHandlerpasses anull(or entry-less)orgUnitCountMapinto expression evaluation. The count should resolve to 0 in that case rather than throwing.The fix reads the map defensively and returns
0dwhen the map is null or the entry is absent.Testing
ExpressionService2Test#testGetExpressionValueOrgUnitGroupCountMissingMemberCountIsZerocovers both the null-map and missing-entry paths (12 * 0 = 0viaexpressionH). Passes, along with the adjacenttestGetExpressionValue.Notes
orgUnitCountMaplocal; the 3-way merge just needed the old throw block dropped). Result is byte-equivalent to the master fix.substituteIndicatorExpressionsdisplay path); this fix is in the analytics indicator-evaluation path.🤖 Generated with Claude Code