← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1571: Fixed bug #531314. Removed sort ordering of periods and applied an ascending sort.

 

------------------------------------------------------------
revno: 1571
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-03-08 08:57:10 +0100
message:
  Fixed bug #531314. Removed sort ordering of periods and applied an ascending sort.
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm


--
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-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java	2010-02-18 15:41:11 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java	2010-03-08 07:57:10 +0000
@@ -40,10 +40,13 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
 import org.hisp.dhis.reporttable.RelativePeriods;
 
 import com.opensymphony.xwork2.Action;
 
+import edu.emory.mathcs.backport.java.util.Collections;
+
 /**
  * @author Lars Helge Overland
  * @version $Id: UploadDesignAction.java 5207 2008-05-22 12:16:36Z larshelg $
@@ -271,24 +274,21 @@
         Chart chart = new Chart();
 
         List<Indicator> indicators = new ArrayList<Indicator>();
-        List<Period> periods = new ArrayList<Period>();
         List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
+        List<Period> periods = new ArrayList<Period>( periodService.getPeriods( getIntegerCollection( selectedPeriods ) ) );
         
         for ( Integer id : getIntegerCollection( selectedIndicators ) )
         {
             indicators.add( indicatorService.getIndicator( id ) );
         }
         
-        for ( Integer id : getIntegerCollection( selectedPeriods ) )
-        {
-            periods.add( periodService.getPeriod( id ) );
-        }
-        
         for ( Integer id : getIntegerCollection( selectedOrganisationUnits ) )
         {
             organisationUnits.add( organisationUnitService.getOrganisationUnit( id ) );
         }
         
+        Collections.sort( periods, new AscendingPeriodComparator() );
+        
         chart.setId( id != null ? id : 0 );
         chart.setTitle( title );
         chart.setType( type );

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm	2010-02-18 15:41:11 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm	2010-03-08 07:57:10 +0000
@@ -42,10 +42,7 @@
             #end
         </select>
     </td>
-    <td>
-        <a href="javascript:moveUpSelectedOption( 'selectedPeriods' )"><img src="../images/move_up.png" border="0" alt=""></a><br><br>
-        <a href="javascript:moveDownSelectedOption( 'selectedPeriods' )"><img src="../images/move_down.png" border="0" alt=""></a>        
-    </td>
+    <td></td>
 </tr>
 <tr>
     <td colspan="2" style="height:15px"></td>