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

TRUNK-6165 - ConceptService getConceptsByMapping should only return d… #4265

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

mseaton
Copy link
Member

@mseaton mseaton commented Mar 7, 2023

…istinct concepts

@mseaton mseaton requested a review from dkayiwa March 7, 2023 16:05
@coveralls
Copy link

coveralls commented Mar 7, 2023

Coverage Status

Coverage: 63.69% (-0.004%) from 63.694% when pulling c3d5711 on TRUNK-6165 into bc67161 on 2.5.x.

@@ -2085,9 +2088,6 @@ private Criteria createSearchConceptMapCriteria(String code, String sourceName,
criteria.addOrder(Order.asc("concept.retired"));
}

// we only want distinct concepts
criteria.setResultTransformer(DistinctRootEntityResultTransformer.INSTANCE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intentionally remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but interested in your thoughts. I think this was a holdover from an earlier time. The root entity here is a ConceptMap, not a Concept. I think the assumption was that this was leading the method to return distinct Concepts, but this was not actually the case. This just resulted in distinct ConceptMaps...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be cautious about removing this and do so only when am very sure that it does not have unintended side effects. At the very least, i would remove it from a commit different for that of fixing duplicate concept ids.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I added it back in @dkayiwa . I don't think it has any impact, so it's not really a problem (though I think it is likely misleading, assuming I'm understanding it correctly). Unit test I added passes either way...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am fine removing it from a separate commit.

@@ -1027,7 +1028,8 @@ public void remove() {
public List<Concept> getConceptsByMapping(String code, String sourceName, boolean includeRetired) {
Criteria criteria = createSearchConceptMapCriteria(code, sourceName, includeRetired);
criteria.setProjection(Projections.property("concept"));
return (List<Concept>) criteria.list();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intentionally leave out a test for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I didn't intentionally add a test. There was no existing test, and the method is deprecated, so I didn't really worry about it.

@dkayiwa dkayiwa merged commit 126f82c into 2.5.x Mar 7, 2023
dkayiwa pushed a commit that referenced this pull request Mar 7, 2023
#4265)

* TRUNK-6165 - ConceptService getConceptsByMapping should only return distinct concepts

* Add back in distinct transformer per code review

(cherry picked from commit 126f82c)
dkayiwa pushed a commit that referenced this pull request Mar 7, 2023
#4265)

* TRUNK-6165 - ConceptService getConceptsByMapping should only return distinct concepts

* Add back in distinct transformer per code review

(cherry picked from commit 126f82c)
suubi-joshua pushed a commit to suubi-joshua/openmrs-core that referenced this pull request Mar 15, 2023
openmrs#4265)

* TRUNK-6165 - ConceptService getConceptsByMapping should only return distinct concepts

* Add back in distinct transformer per code review

(cherry picked from commit 126f82c)
Wandji69 pushed a commit to Wandji69/openmrs-core that referenced this pull request Mar 29, 2024
openmrs#4265)

* TRUNK-6165 - ConceptService getConceptsByMapping should only return distinct concepts

* Add back in distinct transformer per code review

(cherry picked from commit 126f82c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants