From 49e619d8b8d78f61c4fe24ce81b6b4e4607a086f Mon Sep 17 00:00:00 2001 From: zubaira Date: Wed, 16 Oct 2024 20:41:33 +0200 Subject: [PATCH] fix: (2.39) Incorrect follow-up value while saving working list[DHIS2-18206] --- .../EntityQueryCriteria.java | 2 +- ...rackedEntityInstanceFilterServiceTest.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityfilter/EntityQueryCriteria.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityfilter/EntityQueryCriteria.java index 3a532f4d27a6..19e8bd49521f 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityfilter/EntityQueryCriteria.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityfilter/EntityQueryCriteria.java @@ -56,7 +56,7 @@ public class EntityQueryCriteria implements Serializable { * Property indicating whether to filter tracked entity instances whose enrollments are marked for * followup or not */ - private Boolean followUp = false; + private Boolean followUp; /** Property indication the OU for the filter. */ private String organisationUnit; diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentityfilter/TrackedEntityInstanceFilterServiceTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentityfilter/TrackedEntityInstanceFilterServiceTest.java index 0d7bbf91aca8..b9ee33e1c247 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentityfilter/TrackedEntityInstanceFilterServiceTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/trackedentityfilter/TrackedEntityInstanceFilterServiceTest.java @@ -95,6 +95,25 @@ void testAddGet() { assertEquals(trackedEntityInstanceFilterB, trackedEntityInstanceFilterService.get(idB)); } + @Test + void testAddFilterWithAndWithoutFollowUp() { + TrackedEntityInstanceFilter filterWithOutFollowUp = + createTrackedEntityInstanceFilter('A', programA); + TrackedEntityInstanceFilter filterWithFollowUp = + createTrackedEntityInstanceFilter('B', programB); + filterWithFollowUp.getEntityQueryCriteria().setFollowUp(true); + + long idA = trackedEntityInstanceFilterService.add(filterWithOutFollowUp); + long idB = trackedEntityInstanceFilterService.add(filterWithFollowUp); + TrackedEntityInstanceFilter fetchedA = trackedEntityInstanceFilterService.get(idA); + TrackedEntityInstanceFilter fetchedB = trackedEntityInstanceFilterService.get(idB); + + assertEquals(filterWithOutFollowUp, fetchedA); + assertNull(fetchedA.getEntityQueryCriteria().getFollowUp()); + assertEquals(filterWithFollowUp, trackedEntityInstanceFilterService.get(idB)); + assertTrue(fetchedB.getEntityQueryCriteria().getFollowUp()); + } + @Test void testDefaultPrivateAccess() { long idA =