From 981271899146194a381e863c48b24e05dcafa2c7 Mon Sep 17 00:00:00 2001 From: Enrico Colasante Date: Thu, 5 Dec 2024 07:57:21 -0300 Subject: [PATCH] fix: Only use occurreddate to filter events in exporter [DHIS2-17732] (#19363) * fix: Only use occurreddate to filter events in exporter [DHIS2-17732] * Fix review comments --- .../dhis/dxf2/events/event/JdbcEventStore.java | 16 ++-------------- .../converter/EventTrackerConverterService.java | 6 ------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java index 0b1320720b8c..3058782d67c4 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java @@ -1287,25 +1287,13 @@ private StringBuilder getFromWhereClause( if (params.getStartDate() != null) { mapSqlParameterSource.addValue("startDate", params.getStartDate(), Types.TIMESTAMP); - fromBuilder - .append(hlp.whereAnd()) - .append(" (psi.executiondate >= ") - .append(":startDate") - .append(" or (psi.executiondate is null and psi.duedate >= ") - .append(":startDate") - .append(" )) "); + fromBuilder.append(hlp.whereAnd()).append(" psi.executiondate >= :startDate "); } if (params.getEndDate() != null) { mapSqlParameterSource.addValue("endDate", params.getEndDate(), Types.TIMESTAMP); - fromBuilder - .append(hlp.whereAnd()) - .append(" (psi.executiondate < ") - .append(":endDate") - .append(" or (psi.executiondate is null and psi.duedate < ") - .append(":endDate") - .append(" )) "); + fromBuilder.append(hlp.whereAnd()).append(" psi.executiondate < :endDate "); } if (params.getProgramType() != null) { diff --git a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/converter/EventTrackerConverterService.java b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/converter/EventTrackerConverterService.java index 152b417b80a1..e50ea7af34f2 100644 --- a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/converter/EventTrackerConverterService.java +++ b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/converter/EventTrackerConverterService.java @@ -261,12 +261,6 @@ private ProgramStageInstance from( assignedUser.ifPresent(programStageInstance::setAssignedUser); } - if (program.isRegistration() - && programStageInstance.getDueDate() == null - && programStageInstance.getExecutionDate() != null) { - programStageInstance.setDueDate(programStageInstance.getExecutionDate()); - } - for (DataValue dataValue : event.getDataValues()) { EventDataValue eventDataValue = new EventDataValue(); eventDataValue.setValue(dataValue.getValue());