-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
@@ -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); |
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.
Did you intentionally remove this?
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.
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...
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.
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.
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.
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...
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.
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(); |
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.
Did you intentionally leave out a test for this?
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.
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.
openmrs#4265) * TRUNK-6165 - ConceptService getConceptsByMapping should only return distinct concepts * Add back in distinct transformer per code review (cherry picked from commit 126f82c)
openmrs#4265) * TRUNK-6165 - ConceptService getConceptsByMapping should only return distinct concepts * Add back in distinct transformer per code review (cherry picked from commit 126f82c)
…istinct concepts