dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42262
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21599: Fixed filtering on COMPLETE and ACTIVE status in eventRows, some cleanup
------------------------------------------------------------
revno: 21599
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-01-05 18:46:43 +0100
message:
Fixed filtering on COMPLETE and ACTIVE status in eventRows, some cleanup
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2016-01-05 05:42:04 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2016-01-05 17:46:43 +0000
@@ -396,54 +396,32 @@
{
sql += hlp.whereAnd() + " psi.organisationunitid in (" + getCommaDelimitedString( orgUnitIds ) + ") ";
}
-
- if ( params.getEventStatus() == null || EventStatus.isExistingEvent( params.getEventStatus() ) )
- {
- if ( params.getStartDate() != null )
- {
- sql += hlp.whereAnd() + " (psi.executiondate >= '" + getMediumDateString( params.getStartDate() ) + "' "
- + " or (psi.executiondate is null and psi.duedate >= '" + getMediumDateString( params.getStartDate() ) + "')) ";
- }
-
- if ( params.getEndDate() != null )
- {
- sql += hlp.whereAnd() + " (psi.executiondate <= '" + getMediumDateString( params.getEndDate() ) + "' "
- + " or (psi.executiondate is null and psi.duedate <= '" + getMediumDateString( params.getEndDate() ) + "')) ";
- }
- }
- else
- {
- if ( params.getStartDate() != null )
- {
- sql += hlp.whereAnd() + " psi.duedate >= '" + getMediumDateString( params.getStartDate() ) + "' ";
- }
-
- if ( params.getEndDate() != null )
- {
- sql += hlp.whereAnd() + " psi.duedate <= '" + getMediumDateString( params.getEndDate() ) + "' ";
- }
-
+
+ if ( params.getStartDate() != null )
+ {
+ sql += hlp.whereAnd() + " (psi.executiondate >= '" + getMediumDateString( params.getStartDate() ) + "' "
+ + " or (psi.executiondate is null and psi.duedate >= '" + getMediumDateString( params.getStartDate() ) + "')) ";
+ }
+
+ if ( params.getEndDate() != null )
+ {
+ sql += hlp.whereAnd() + " (psi.executiondate <= '" + getMediumDateString( params.getEndDate() ) + "' "
+ + " or (psi.executiondate is null and psi.duedate <= '" + getMediumDateString( params.getEndDate() ) + "')) ";
+ }
+
+ if ( params.getEventStatus() != null )
+ {
if ( params.getEventStatus() == EventStatus.VISITED )
{
- sql = "and psi.status = '" + EventStatus.ACTIVE.name() + "' and psi.executiondate is not null ";
- }
- else if ( params.getEventStatus() == EventStatus.COMPLETED )
- {
- sql = "and psi.status = '" + EventStatus.COMPLETED.name() + "' ";
- }
- else if ( params.getEventStatus() == EventStatus.SCHEDULE )
- {
- sql += "and psi.executiondate is null and date(now()) <= date(psi.duedate) and psi.status = '" +
- EventStatus.SCHEDULE.name() + "' ";
+ sql += hlp.whereAnd() + " psi.status = '" + EventStatus.ACTIVE.name() + "' and psi.executiondate is not null ";
}
else if ( params.getEventStatus() == EventStatus.OVERDUE )
{
- sql += "and psi.executiondate is null and date(now()) > date(psi.duedate) and psi.status = '" +
- EventStatus.SCHEDULE.name() + "' ";
+ sql += hlp.whereAnd() + " date(now()) > date(psi.duedate) and psi.status = '" + EventStatus.SCHEDULE.name() + "' ";
}
else
{
- sql += "and psi.status = '" + params.getEventStatus().name() + "' ";
+ sql += hlp.whereAnd() + " psi.status = '" + params.getEventStatus().name() + "' ";
}
}