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

chore: move handling of total count and pagination to store [TECH-1661] #15482

Merged
merged 8 commits into from
Oct 27, 2023

Conversation

enricocolasante
Copy link
Contributor

Having the logic of fetching pageSize + 1 tracked entities in the store and the removal of the extra enrollment in the service is error prone. This is now done transparently in the store.

Total count is expensive and should thus be discouraged. Do not expose this as part of the service as its not needed right now.

In this PR

Remove any pagination related fields and methods from TrackedEntityQueryParams as these are fully represented by the PageParams.
Remove lastPage concept as it is not exposed
Validate pagination params in the controller

Update dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/export/OrderAndPaginationExporterTest.java

chore: split fetching all TEs from fetching paginated TEs [TECH-1661]

chore: split fetching all TEs from fetching paginated TEs [TECH-1661]
@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Merging #15482 (4bb1dff) into master (8183caa) will decrease coverage by 0.02%.
Report is 1 commits behind head on master.
The diff coverage is 82.85%.

@@             Coverage Diff              @@
##             master   #15482      +/-   ##
============================================
- Coverage     66.16%   66.15%   -0.02%     
+ Complexity    31193    31178      -15     
============================================
  Files          3487     3485       -2     
  Lines        129766   129745      -21     
  Branches      15137    15134       -3     
============================================
- Hits          85858    85830      -28     
- Misses        36822    36830       +8     
+ Partials       7086     7085       -1     
Flag Coverage Δ
integration 49.70% <80.00%> (-0.02%) ⬇️
integration-h2 32.40% <62.85%> (-0.03%) ⬇️
unit 30.33% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...hisp/dhis/tracker/export/event/JdbcEventStore.java 85.04% <ø> (-0.04%) ⬇️
...ort/trackedentity/DefaultTrackedEntityService.java 61.45% <100.00%> (-1.19%) ⬇️
...export/trackedentity/TrackedEntityQueryParams.java 68.00% <ø> (-1.28%) ⬇️
...acker/export/trackedentity/TrackedEntityStore.java 0.00% <ø> (ø)
...trackedentity/TrackedEntitiesExportController.java 72.50% <100.00%> (+0.34%) ⬆️
...ort/trackedentity/HibernateTrackedEntityStore.java 58.46% <77.77%> (+1.35%) ⬆️

... and 12 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8183caa...4bb1dff. Read the comment docs.

@enricocolasante enricocolasante marked this pull request as ready for review October 26, 2023 09:38
private Integer page;
private Integer pageSize;
private Boolean totalPages;
private Boolean skipPaging;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PageRequestParams.getSkipPaging
; it is advisable to add an Override annotation.
static final String DEFAULT_FIELDS_PARAM =
"relationship,relationshipType,createdAtClient,from[trackedEntity[trackedEntity],enrollment[enrollment],event[event]],to[trackedEntity[trackedEntity],enrollment[enrollment],event[event]]";

private Integer page;
private Integer pageSize;
private Boolean totalPages;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PageRequestParams.getTotalPages
; it is advisable to add an Override annotation.
static final String DEFAULT_FIELDS_PARAM =
"relationship,relationshipType,createdAtClient,from[trackedEntity[trackedEntity],enrollment[enrollment],event[event]],to[trackedEntity[trackedEntity],enrollment[enrollment],event[event]]";

private Integer page;
private Integer pageSize;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PageRequestParams.getPageSize
; it is advisable to add an Override annotation.
static final String DEFAULT_FIELDS_PARAM =
"relationship,relationshipType,createdAtClient,from[trackedEntity[trackedEntity],enrollment[enrollment],event[event]],to[trackedEntity[trackedEntity],enrollment[enrollment],event[event]]";

private Integer page;

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PageRequestParams.getPage
; it is advisable to add an Override annotation.
@sonarcloud
Copy link

sonarcloud bot commented Oct 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@enricocolasante enricocolasante merged commit 5b62825 into master Oct 27, 2023
18 checks passed
@enricocolasante enricocolasante deleted the TECH-1661-pagination-to-store branch October 27, 2023 08:25
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.

2 participants