-
Notifications
You must be signed in to change notification settings - Fork 354
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: AuditType failing enum conversion when get tracked entity audits [DHIS2-15805] #14632
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #14632 +/- ##
============================================
+ Coverage 66.41% 66.43% +0.02%
- Complexity 31548 31560 +12
============================================
Files 3506 3506
Lines 130523 130525 +2
Branches 15224 15228 +4
============================================
+ Hits 86684 86716 +32
+ Misses 36767 36739 -28
+ Partials 7072 7070 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 18 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
https://dhis2.atlassian.net/browse/DHIS2-15805
Note: This is the
audit
that will soon convert tochangelog
The
addTrackedEntityAudit
in theHibernateTrackedEntityAuditStore
method for a list ofTrackedEntityAudit
inserts lowercaseAuditType
.Eventually, some audits are lowercase on the database, and others inserted by other methods are uppercase.
Then, when getting back a list of audits, hibernate cannot convert the enum when the audit type is lowercase.
The Audit type is exposed as upper case in the endpoints.
Notice that this error is not showing in
DefaultTrackedEntityAuditService
because it is@Async
Solution:
We could leverage at a query level to convert to uppercase. However, a straightforward solution is to make the
addTrackedEntityAudit
work the same as the other audits and rename what is lowercase in the database.It seems that only the
trackedentityaudit
is currently affected. However, we apply the same database update for the other audit tables, which could potentially have had the same logic in the past.Notice also that this issue is internally reported and not by any user. Therefore, it might be that, for example, the changelog is not enabled by instances, and there are no records to update. Or the endpoint is not queried.
When passing the audit type as a parameter in a request, the endpoints should be able to manage the lowercase in case.
This also drops the
metadataaudit
table that apparently is not in use.