Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix for slow counting of org units for search results. #3798

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

alex-vt
Copy link

@alex-vt alex-vt commented Sep 19, 2024

Description

A performance issue within the SearchTEActivity:

  • When opening a Program with a large numbers (hundreds) on Tracked Entity Instances (TEIs) in an instance with a large number of Organization Units, the list of TEIs takes a long time (up to tens of seconds) to load.
  • After adding a new TEI and navigating back to the list, the changes take similarly long time to appear in the list.

The underlying cause: in SearchRepositoryImpl, while a TEI is loaded, visibility of its Org Unit is computed non-optimally: Org Units are retrieved from the d2 data layer and then counted, but can be counted in d2 directly and then the number retrieved instead.

The affected code was intruduced as part of the ANDROAPP-5724 UX improvement feature, the exact line of code in the corresponding PR is here.

About Jira issue: I am an external contributor and do not have access to create one. Will happily specify one if instructed to.

Solution description

Org Units were retrieved from the d2 data layer and then counted, but can be counted in d2 directly and then the number retrieved instead. This solves long load times for programs with large number of TEIs and Org Units.

Covered unit test cases

The modified class does not appear to have unit test coverage. No new tests added.

Where did you test this issue?

  • Smartphone Emulator
  • Tablet Emulator
  • Smartphone
  • Tablet

Which Android versions did you test this issue?

  • 4.4
  • 5.X - 6.X
  • 7.X
  • 8.X
  • 9.X - 10.X
  • 11.X - 13.X
  • Other: 14

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code

Org units were retrieved from d2 and then counted, but can be counted in d2 and then the number retrieved instead.
This solves long load times for programs with large number of TEIs and org units.
Copy link

sonarcloud bot commented Sep 21, 2024

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

Successfully merging this pull request may close these issues.

2 participants