Details
-
Bug
-
Status: Closed
-
Must
-
Resolution: Fixed
-
Platform 2.0.0, Platform 2.0.1
-
None
-
Undetermined
Description
Setmembers are sorted in such a way that retired concepts are pushed to the end of list irrespective of its sort weight as part TRUNK-3840.
Let say, we have concept with set members sorted as per the current implementation:
1. Concept(#200) with sortweight as 1010 and not retired
2. Concept(#199) with sortweight as 1000 and retired
Scenario 1:
When a new setmember is to be added at the end of the list, it gets the last set member and add 10 to its sort weight, so the sort weight of new member will be 1010 and it will not get added to the set members since there is already a setmember(Concept #200) with sortweight as 1010
https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/Concept.java#L1642
Scenario 2:
When a new set member is to be added at index 1, it will try to find the mean of previous and next set member, in the above example it would be 1005. So it would get added at index 0 instead of index 1 since setmember at index 0 has sort weight as 1010.
https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/Concept.java#L1649