Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4945

Adding setmember to concept with retired set members either does not get added up or gets added in the wrong position

    XMLWordPrintable

Details

    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

      Gliffy Diagrams

        Attachments

          Activity

            People

              dkayiwa Daniel Kayiwa
              gauravd Gaurav Deshkar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: