SetMembers Are Not Getting Added In Concept

Description: When Concept.ConceptSets already has retired concept , and we try to add new set member it doesn’t get added. This is causing because changes in ConceptSet.compareTo() as part of TRUNK-3840

Test case:

/**
	 * @see Concept#addSetMember(Concept)
	 */
	@Test
	@Verifies(value = "should append concept to the existing list of conceptSet having retired concept", method = "addSetMember(Concept)")
	public void addSetMember_shouldAppendConceptToExistingConceptSetHavingRetiredConcept() throws Exception {
		Concept concept = new Concept();
		Concept setMember1 = new Concept(1);
		setMember1.setRetired(true);
		concept.addSetMember(setMember1);
		Concept setMember2 = new Concept(2);
		concept.addSetMember(setMember2);
		Concept setMember3 = new Concept(3);
		concept.addSetMember(setMember3);
		assertThat(concept.getSetMembers(),hasItem(setMember1));
		assertThat(concept.getSetMembers(),hasItem(setMember2));
		assertThat(concept.getSetMembers(),hasItem(setMember3));
		assertThat(concept.getSetMembers().size(),is(3));
	}

Very good catch! Do you mind going ahead to create a ticket? If you have a pull request, that would be awesome! :smile:

Hey , I have created the issue TRUNK-4945. The sort logic has been changed in such a way to display retired members at the bottom of the list in UI as part of TRUNK-3840. But using the ‘retired’ field in compareTo method messes up with adding set member positioning logic. I am not sure how should we go about solving it. Instead of using retired field in compareTo, we should go about finding some other way to display members at the bottom of the list in UI.

I agree that it makes sense to sort retired to the end in the UI rather than the API. If you want to make that change, I support doing it that way (so, making a change here, and I guess also to the legacy-ui module).

I’m a bit concerned that it will be a lot of effort to backport the change as far back as TRUNK-3840 was backported. Another approach could be that the real bug is that generating a sort weight is happening wrong, and there could be a quick fix there.

(Looks like Daniel committed a fix for this issue while I was typing that last post. See the ticket.)