Skip to content

Commit

Permalink
fix: Only use occurreddate to filter events in exporter [DHIS2-17732] (
Browse files Browse the repository at this point in the history
…#19363)

* fix: Only use occurreddate to filter events in exporter [DHIS2-17732]

* Fix review comments
  • Loading branch information
enricocolasante committed Dec 11, 2024
1 parent 57f4ddd commit 73feab1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,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());
Expand Down

0 comments on commit 73feab1

Please sign in to comment.