← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3420: Fix for bug #761919 - made tallysheet-generator ignore values that dont convert to integers

 

------------------------------------------------------------
revno: 3420
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-04-18 10:42:21 +0200
message:
  Fix for bug #761919 - made tallysheet-generator ignore values that dont convert to integers
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetService.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-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetService.java	2010-04-28 15:14:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/tallysheet/DefaultTallySheetService.java	2011-04-18 08:42:21 +0000
@@ -69,12 +69,12 @@
     public TallySheet createTallySheet( OrganisationUnit organisationUnit, List<DataElement> dataElements,
         boolean a3Format, boolean displayFacilityName, DataSet selectedDataSet, String tallySheetName )
     {
-        PeriodType periodType = selectedDataSet.getPeriodType();        
+        PeriodType periodType = selectedDataSet.getPeriodType();
 
         Collection<DataValue> dataValues = new HashSet<DataValue>();
 
         for ( DataElement dataElement : dataElements )
-        {           
+        {
 
             DataValue dataValue = dataValueService.getLatestDataValues( dataElement, periodType, organisationUnit );
 
@@ -85,8 +85,8 @@
 
         }
 
-        return internalCreateTallySheet( organisationUnit, dataElements, dataValues, a3Format,
-            displayFacilityName, tallySheetName );
+        return internalCreateTallySheet( organisationUnit, dataElements, dataValues, a3Format, displayFacilityName,
+            tallySheetName );
     }
 
     // -------------------------------------------------------------------------
@@ -94,8 +94,7 @@
     // -------------------------------------------------------------------------
 
     private TallySheet internalCreateTallySheet( OrganisationUnit organisationUnit, List<DataElement> dataElements,
-        Collection<DataValue> dataValues, boolean a3Format, boolean displayFacilityName,
-        String tallySheetName )
+        Collection<DataValue> dataValues, boolean a3Format, boolean displayFacilityName, String tallySheetName )
     {
         TallySheet tallySheet = new TallySheet();
 
@@ -112,10 +111,18 @@
 
             for ( DataValue dataValue : dataValues )
             {
+
                 if ( dataValue.getSource().equals( organisationUnit )
                     && dataValue.getDataElement().equals( dataElement ) )
                 {
-                    calculatedNumberOfElements = Integer.parseInt( dataValue.getValue() );
+                    try
+                    {
+                        calculatedNumberOfElements = Integer.parseInt( dataValue.getValue() );
+                    }
+                    catch ( NumberFormatException e )
+                    {
+                        continue;
+                    }
 
                     break;
                 }