← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16312: Analytics, sorting periods on end date, then period type instead of currently start date, then en...

 

------------------------------------------------------------
revno: 16312
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-08-04 20:22:23 +0200
message:
  Analytics, sorting periods on end date, then period type instead of currently start date, then end date.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/comparator/AscendingPeriodEndDateComparator.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.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/period/comparator/AscendingPeriodEndDateComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/comparator/AscendingPeriodEndDateComparator.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/comparator/AscendingPeriodEndDateComparator.java	2014-08-04 18:22:23 +0000
@@ -33,14 +33,16 @@
 import org.hisp.dhis.period.Period;
 
 /**
- * Sorts periods ascending based on the end date, then the periodtype frequency order.
+ * Sorts periods ascending based on the end date, then the period type frequency 
+ * order.
  * 
  * @author Jan Henrik Overland
- * @version $Id$
  */
 public class AscendingPeriodEndDateComparator
     implements Comparator<Period>
 {
+    public static final AscendingPeriodEndDateComparator INSTANCE = new AscendingPeriodEndDateComparator();
+    
     public int compare( Period period1, Period period2 )
     {
         if ( period1.getEndDate() == null )

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2014-08-04 18:01:04 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2014-08-04 18:22:23 +0000
@@ -126,7 +126,7 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.RelativePeriodEnum;
 import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
+import org.hisp.dhis.period.comparator.AscendingPeriodEndDateComparator;
 import org.hisp.dhis.reporttable.ReportTable;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.system.util.ConversionUtils;
@@ -955,7 +955,7 @@
             }
 
             List<Period> periodList = new ArrayList<Period>( periods );
-            Collections.sort( periodList, AscendingPeriodComparator.INSTANCE );
+            Collections.sort( periodList, AscendingPeriodEndDateComparator.INSTANCE );
             
             DimensionalObject object = new BaseDimensionalObject( dimension, DimensionType.PERIOD, null, DISPLAY_NAME_PERIOD, asList( periodList ) );