-
Notifications
You must be signed in to change notification settings - Fork 352
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: let COC.isDefault look at its own name only DHIS2-14968 #19266
base: master
Are you sure you want to change the base?
Conversation
0e89d40
to
acc07d9
Compare
dhis-2/dhis-api/src/main/java/org/hisp/dhis/category/CategoryOptionCombo.java
Outdated
Show resolved
Hide resolved
dhis-2/dhis-api/src/test/java/org/hisp/dhis/category/CategoryOptionComboTest.java
Outdated
Show resolved
Hide resolved
dhis-2/dhis-api/src/main/java/org/hisp/dhis/category/CategoryOptionCombo.java
Outdated
Show resolved
Hide resolved
acc07d9
to
4fed058
Compare
4fed058
to
22b5ef1
Compare
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Jim mentioned there is code using the wrong constant for the string "default" because they all are the same but good that you cleaned that up as well. It is a bit confusing and I assume was just a copy&paste or autocomplete mistake made in the past.
Hmm. Is this the only way to solve this problem? I see that all of the tests pass, but I do worry about changing this for this particular reason. What happens when there are multiple default COCs? I have been working on a PR here to prevent import of new/duplicate COCs, and we have some integrity checks around this as well, but we do know of systems which either have a default CC/CO/COC which are not the hard-coded ones which we currently have, or which have actual duplicate default COCs (i.e multiple "default" COCs) which are associated with the default CC. |
discovered while implementing #19252
Category option combos are not always fetched using hibernate. In tracker we use jdbc when fetching events and only fetch and map what's needed. We thus do not get the category combo. This means that
coc.isDefault()
returnsfalse
even if it is thedefault
coc.We want to change
isDefault
Default category/option/combo are created on startup
dhis2-core/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/category/DefaultCategoryService.java
Line 378 in 916f741
The category option name is unique and the system "takes" the
default
name. The coc is generated from the co and so is its name which isdefault
.When retrieving the default coc from the service it already relies on the name
default
dhis2-core/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/category/DefaultCategoryService.java
Lines 582 to 584 in 916f741