← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18551: Minor

 

------------------------------------------------------------
revno: 18551
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-10 12:19:30 +0100
message:
  Minor
modified:
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.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-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-03-09 17:44:08 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java	2015-03-10 11:19:30 +0000
@@ -187,7 +187,7 @@
     @Override
     public String getProgramIndicatorValue( ProgramInstance programInstance, ProgramIndicator programIndicator )
     {
-        Double value = getValue( programInstance, programIndicator.getValueType(), programIndicator.getExpression() );
+        Double value = getValue( programInstance, programIndicator );
 
         if ( value != null )
         {
@@ -376,12 +376,12 @@
     // Supportive methods
     // -------------------------------------------------------------------------
 
-    private Double getValue( ProgramInstance programInstance, String valueType, String expression )
+    private Double getValue( ProgramInstance programInstance, ProgramIndicator indicator )
     {
         StringBuffer description = new StringBuffer();
 
         Pattern pattern = Pattern.compile( ProgramIndicator.regExp );
-        Matcher matcher = pattern.matcher( expression );
+        Matcher matcher = pattern.matcher( indicator.getExpression() );
 
         while ( matcher.find() )
         {
@@ -409,7 +409,7 @@
 
                     String value = dataValue.getValue();
 
-                    if ( valueType.equals( ProgramIndicator.VALUE_TYPE_INT ) && 
+                    if ( indicator.getValueType().equals( ProgramIndicator.VALUE_TYPE_INT ) && 
                         ( dataElement == null || dataElement.getType().equals( DataElement.VALUE_TYPE_DATE ) ) )
                     {
                         value = DateUtils.daysBetween( new Date(), DateUtils.getDefaultDate( value ) ) + " ";