[OCG] [fix] On tracker TEIs sync, copy only teis updated [DHIS2-15223] #70
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.
On 2.37.8.1, all TEIs are synced on the job sync, even if they were already synced before. This worked for 2.33.5, so let's compare:
https://github.com/dhis2/dhis2-core/blob/2.37.8.1/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java#L603
https://github.com/dhis2/dhis2-core/blob/2.33.5/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java#L264
The problems is that the condition "tei.lastUpdated > tei.lastSynchronized" when params.isSynchronizationQuery()" was removed. Checking git history, this logic was changed here (first affected version: 2.37.3):
dhis2@ed1a022#diff-f960125887353fe285946328173a4e612632e40c0bca283e9d30c824348764dbL383
And the logic was reinstated here (first version fixed: 2.38.4, not backported to 2.37):
dhis2@946c066#diff-f960125887353fe285946328173a4e612632e40c0bca283e9d30c824348764dbR663
Associated JIRA issue: https://dhis2.atlassian.net/browse/DHIS2-15223