← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14348: Minor fix.

 

------------------------------------------------------------
revno: 14348
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-03-23 17:06:52 +0700
message:
  Minor fix.
modified:
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.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/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2014-03-18 14:54:13 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2014-03-23 10:06:52 +0000
@@ -263,13 +263,7 @@
         List<Grid> grids = new ArrayList<Grid>();
 
         // ---------------------------------------------------------------------
-        // Get registered personal entityInstance data
-        // ---------------------------------------------------------------------
-
-        Grid attrGrid = new ListGrid();
-
-        // ---------------------------------------------------------------------
-        // Add dynamic attribues
+        // Dynamic attributes
         // ---------------------------------------------------------------------
 
         Collection<Program> programs = programService
@@ -293,21 +287,29 @@
             }
         }
 
-        for ( TrackedEntityAttributeValue attributeValue : attributeValues )
+        if ( attributeValues.size() > 0 )
         {
-            attrGrid.addRow();
-            attrGrid.addValue( attributeValue.getAttribute().getDisplayName() );
-            String value = attributeValue.getValue();
-            if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_BOOL ) )
+            Grid attrGrid = new ListGrid();
+
+            for ( TrackedEntityAttributeValue attributeValue : attributeValues )
             {
-                value = i18n.getString( value );
+                attrGrid.addRow();
+                attrGrid.addValue( attributeValue.getAttribute().getDisplayName() );
+                String value = attributeValue.getValue();
+
+                if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE )
+                    && value != null )
+                {
+                    Date date = format.parseDate( value );
+                    value = TrackedEntityAttribute.getAgeFromDate( date ) + "";
+                }
+
+                attrGrid.addValue( value );
             }
 
-            attrGrid.addValue( value );
+            grids.add( attrGrid );
         }
 
-        grids.add( attrGrid );
-
         // ---------------------------------------------------------------------
         // Get all program data registered
         // ---------------------------------------------------------------------
@@ -486,7 +488,7 @@
                 && rm.getWhenToSend() != null
                 && rm.getWhenToSend() == status
                 && (rm.getMessageType() == TrackedEntityInstanceReminder.MESSAGE_TYPE_DHIS_MESSAGE || rm
-                .getMessageType() == TrackedEntityInstanceReminder.MESSAGE_TYPE_BOTH) )
+                    .getMessageType() == TrackedEntityInstanceReminder.MESSAGE_TYPE_BOTH) )
             {
                 int id = messageService.sendMessage( programInstance.getProgram().getDisplayName(),
                     reminderService.getMessageFromTemplate( rm, programInstance, format ), null,