dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10767
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2956: Removed time aggregation in completeness export, too slow, will implement in SQL later
------------------------------------------------------------
revno: 2956
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-03-01 22:07:47 +0100
message:
Removed time aggregation in completeness export, too slow, will implement in SQL later
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessResult.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.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-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessResult.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessResult.java 2011-03-01 17:14:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/completeness/DataSetCompletenessResult.java 2011-03-01 21:07:47 +0000
@@ -134,21 +134,6 @@
return 0.0;
}
- public void incrementSources( int sources )
- {
- this.sources += sources;
- }
-
- public void incrementRegistrations( int registrations )
- {
- this.registrations += registrations;
- }
-
- public void incrementRegistrationsOnTime( int registrationsOnTime )
- {
- this.registrationsOnTime += registrationsOnTime;
- }
-
// -------------------------------------------------------------------------
// HashCode, equals, and toString
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java 2011-03-01 20:32:55 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/completeness/impl/AbstractDataSetCompletenessService.java 2011-03-01 21:07:47 +0000
@@ -175,42 +175,21 @@
OrganisationUnitHierarchy hierarchy = organisationUnitService.getOrganisationUnitHierarchy();
hierarchy.prepareChildren( units );
- Collection<Period> intersectingPeriods = null;
- Date deadline = null;
- DataSetCompletenessResult result = null;
+ //TODO Re-implement period aggregation with sql to improve performance
for ( final Period period : periods )
{
- intersectingPeriods = periodService.getIntersectingPeriods( period.getStartDate(), period.getEndDate() );
-
for ( final OrganisationUnit unit : units )
{
for ( final DataSet dataSet : dataSets )
{
- final DataSetCompletenessResult aggregatedResult = new DataSetCompletenessResult();
-
- aggregatedResult.setDataSetId( dataSet.getId() );
- aggregatedResult.setPeriodId( period.getId() );
- aggregatedResult.setPeriodName( period.getName() );
- aggregatedResult.setOrganisationUnitId( unit.getId() );
-
- for ( final Period intersectingPeriod : intersectingPeriods )
- {
- if ( intersectingPeriod.getPeriodType().equals( dataSet.getPeriodType() ) )
- {
- deadline = getDeadline( intersectingPeriod, days );
-
- result = getDataSetCompleteness( intersectingPeriod, deadline, unit, hierarchy, dataSet );
-
- aggregatedResult.incrementSources( result.getSources() );
- aggregatedResult.incrementRegistrations( result.getRegistrations() );
- aggregatedResult.incrementRegistrationsOnTime( result.getRegistrationsOnTime() );
- }
- }
-
- if ( aggregatedResult.getSources() > 0 )
- {
- batchHandler.addObject( aggregatedResult );
+ final Date deadline = getDeadline( period, days );
+
+ final DataSetCompletenessResult result = getDataSetCompleteness( period, deadline, unit, hierarchy, dataSet );
+
+ if ( result.getSources() > 0 )
+ {
+ batchHandler.addObject( result );
}
}
}
@@ -312,6 +291,7 @@
result.setDataSetId( dataSet.getId() );
result.setPeriodId( period.getId() );
+ result.setPeriodName( period.getName() );
result.setOrganisationUnitId( unit.getId() );
return result;
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java 2011-03-01 20:32:55 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java 2011-03-01 21:07:47 +0000
@@ -187,9 +187,5 @@
assertEquals( 100.0, completenessStore.getPercentage( dataSetA.getId(), periodB.getId(), unitB.getId() ) );
assertEquals( 0.0, completenessStore.getPercentage( dataSetA.getId(), periodB.getId(), unitC.getId() ) );
assertEquals( 66.7, completenessStore.getPercentage( dataSetA.getId(), periodB.getId(), unitA.getId() ) );
-
- assertEquals( 100.0, completenessStore.getPercentage( dataSetA.getId(), periodC.getId(), unitB.getId() ) );
- assertEquals( 50.0, completenessStore.getPercentage( dataSetA.getId(), periodC.getId(), unitC.getId() ) );
- assertEquals( 66.7, completenessStore.getPercentage( dataSetA.getId(), periodC.getId(), unitA.getId() ) );
}
}