← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3004: Fixed issue with getIntersectionPeriods method in PeriodStore which affected periods of daily per...

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 3004 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-03-11 10:38:23 +0100
message:
  Fixed issue with getIntersectionPeriods method in PeriodStore which affected periods of daily period types
modified:
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/test/java/org/hisp/dhis/aggregation/AggregationStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.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-aggregationengine-default/src/test/java/org/hisp/dhis/aggregation/AggregationStoreTest.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/test/java/org/hisp/dhis/aggregation/AggregationStoreTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/test/java/org/hisp/dhis/aggregation/AggregationStoreTest.java	2011-03-11 08:13:14 +0000
@@ -187,11 +187,11 @@
         
         Collection<DataValue> dataValues3 = aggregationStore.getDataValues( sources, dataElementA.getId(), optionCombo.getId(), periods );
 
-        assertEquals( dataValues3.size(), 6 );
+        assertEquals( dataValues3.size(), 8 );
 
         Collection<DataValue> dataValues4 = aggregationStore.getDataValues( sourceA.getId(), dataElementA.getId(), optionCombo.getId(), periods );
 
-        assertEquals( dataValues4.size(), 2 );        
+        assertEquals( dataValues4.size(), 3 );        
 
         statementManager.destroy();
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java	2011-03-01 14:44:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java	2011-03-11 08:13:14 +0000
@@ -150,8 +150,8 @@
 
         Criteria criteria = session.createCriteria( Period.class );
         criteria.add( Restrictions.eq( "periodType", reloadPeriodType( periodType ) ) );
-        criteria.add( Restrictions.gt( "endDate", startDate ) );
-        criteria.add( Restrictions.lt( "startDate", endDate ) );
+        criteria.add( Restrictions.ge( "endDate", startDate ) );
+        criteria.add( Restrictions.le( "startDate", endDate ) );
 
         return criteria.list();
     }
@@ -162,8 +162,8 @@
         Session session = sessionFactory.getCurrentSession();
 
         Criteria criteria = session.createCriteria( Period.class );
-        criteria.add( Restrictions.gt( "endDate", startDate ) );
-        criteria.add( Restrictions.lt( "startDate", endDate ) );
+        criteria.add( Restrictions.ge( "endDate", startDate ) );
+        criteria.add( Restrictions.le( "startDate", endDate ) );
         
         return criteria.list();
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java	2010-06-23 17:50:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java	2011-03-11 08:13:14 +0000
@@ -422,11 +422,13 @@
         
         Collection<Period> periods = periodService.getIntersectingPeriods( getDay( 4 ), getDay( 10 ) );
         
-        assertEquals( periods.size(), 6 );
-        
+        assertEquals( periods.size(), 8 );
+
+        assertTrue( periods.contains( periodB ) );
         assertTrue( periods.contains( periodC ) );
         assertTrue( periods.contains( periodD ) );
         assertTrue( periods.contains( periodE ) );
+        assertTrue( periods.contains( periodF ) );
         assertTrue( periods.contains( periodH ) );
         assertTrue( periods.contains( periodI ) );
         assertTrue( periods.contains( periodJ ) );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java	2010-07-04 10:31:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java	2011-03-11 08:13:14 +0000
@@ -477,11 +477,13 @@
         
         Collection<Period> periods = periodStore.getIntersectingPeriods( getDay( 4 ), getDay( 10 ) );
         
-        assertEquals( periods.size(), 6 );
-        
+        assertEquals( periods.size(), 8 );
+
+        assertTrue( periods.contains( periodB ) );
         assertTrue( periods.contains( periodC ) );
         assertTrue( periods.contains( periodD ) );
         assertTrue( periods.contains( periodE ) );
+        assertTrue( periods.contains( periodF ) );
         assertTrue( periods.contains( periodH ) );
         assertTrue( periods.contains( periodI ) );
         assertTrue( periods.contains( periodJ ) );