← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2305: Impl support for totals in indicator formulas

 

------------------------------------------------------------
revno: 2305
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2010-12-07 18:02:27 +0100
message:
  Impl support for totals in indicator formulas
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceMultiDimensionTest.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginfailed.html
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.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-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java	2010-09-27 09:24:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java	2010-12-07 17:02:27 +0000
@@ -111,6 +111,15 @@
     }
 
     // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
+    public boolean isDefault()
+    {
+        return name.equals( DEFAULT_CATEGORY_COMBO_NAME );
+    }
+    
+    // -------------------------------------------------------------------------
     // hashCode, equals and toString
     // -------------------------------------------------------------------------
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2010-12-04 00:03:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2010-12-07 17:02:27 +0000
@@ -330,6 +330,15 @@
      * @return the Operands for the given Collection of DataElements.
      */
     Collection<DataElementOperand> getOperands( Collection<DataElement> dataElements );
+
+    /**
+     * Gets the Operands for the given Collection of DataElements.
+     * 
+     * @param dataElements the Collection of DataElements.
+     * @param includeTotals whether to include DataElement totals in the Collection of Operands.
+     * @return the Operands for the given Collection of DataElements.
+     */
+    Collection<DataElementOperand> getOperands( Collection<DataElement> dataElements, boolean includeTotals );
     
     /**
      * Gets the Operands for the given Collection of DataElements. Operands will contain DataElement and CategoryOptionCombo object  

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java	2010-12-05 19:34:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperand.java	2010-12-07 17:02:27 +0000
@@ -45,11 +45,12 @@
     implements Serializable, Comparable<DataElementOperand>
 {
     public static final String SEPARATOR = ".";
+    public static final String NAME_TOTAL = "(Total)";
     
     private static final String TYPE_VALUE = "value";
     private static final String TYPE_TOTAL = "total";
     
-    private static final String SPACE = "";
+    private static final String SPACE = " ";
     private static final String COLUMN_PREFIX = "de";
     private static final String COLUMN_SEPARATOR = "_";
 
@@ -208,11 +209,16 @@
      */
     public String getPrettyName( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo )
     {
-        if ( dataElement == null || categoryOptionCombo == null )
+        if ( dataElement == null ) // Invalid
         {
             return null;
         }
         
+        if ( categoryOptionCombo == null ) // Total
+        {
+            return dataElement.getName() + SPACE + NAME_TOTAL;
+        }
+        
         return categoryOptionCombo.isDefault() ? dataElement.getName() : dataElement.getName() + SPACE + categoryOptionCombo.getName();
     }
     
@@ -245,6 +251,23 @@
     }
 
     /**
+     * Updates all transient properties.
+     * 
+     * @param dataElement
+     * @param categoryOptionCombo
+     */
+    public void updateProperties( DataElement dataElement )
+    {
+        this.dataElementId = dataElement.getId();
+        this.operandId = String.valueOf( dataElement.getId() );
+        this.operandName = dataElement.getName() + SPACE + NAME_TOTAL;
+        this.aggregationOperator = dataElement.getAggregationOperator();
+        this.frequencyOrder = dataElement.getFrequencyOrder();
+        this.aggregationLevels = new ArrayList<Integer>( dataElement.getAggregationLevels() );
+        this.valueType = dataElement.getType();        
+    }
+
+    /**
      * Generates a DataElementOperand based on the given formula. The formula
      * needs to be on the form "[<dataelementid>,<categoryoptioncomboid>]".
      * 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2010-12-04 00:03:38 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2010-12-07 17:02:27 +0000
@@ -401,22 +401,35 @@
         return operands;
     }
     
+    public Collection<DataElementOperand> getOperands( Collection<DataElement> dataElements, boolean includeTotals )
+    {
+        Collection<DataElementOperand> operands = new ArrayList<DataElementOperand>();
+
+        for ( DataElement dataElement : dataElements )
+        {
+            if ( !dataElement.getCategoryCombo().isDefault() && includeTotals )
+            {
+                DataElementOperand operand = new DataElementOperand();
+                operand.updateProperties( dataElement );
+                
+                operands.add( operand );
+            }
+            
+            for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getOptionCombos() )
+            {
+                DataElementOperand operand = new DataElementOperand();
+                operand.updateProperties( dataElement, categoryOptionCombo );
+
+                operands.add( operand );
+            }
+        }
+
+        return operands;
+    }
+    
     public Collection<DataElementOperand> getOperands( Collection<DataElement> dataElements )
     {
-        Collection<DataElementOperand> operands = new ArrayList<DataElementOperand>();
-
-        for ( DataElement dataElement : dataElements )
-        {
-            for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getOptionCombos() )
-            {
-                DataElementOperand operand = new DataElementOperand();
-                operand.updateProperties( dataElement, categoryOptionCombo );
-
-                operands.add( operand );
-            }
-        }
-
-        return operands;
+        return getOperands( dataElements, false );
     }
 
     public Collection<DataElementOperand> getFullOperands( Collection<DataElement> dataElements )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java	2010-12-06 21:06:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java	2010-12-07 17:02:27 +0000
@@ -322,13 +322,8 @@
                         + operand.getOptionComboId() );
                 }
 
-                match = dataElement.getName();
+                match = operand.getPrettyName( dataElement, categoryOptionCombo );
                 
-                if ( !categoryOptionCombo.isDefault() )
-                {
-                    match += SPACE + categoryOptionCombo.getName();
-                }
-
                 matcher.appendReplacement( buffer, match );
             }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2010-12-06 14:13:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2010-12-07 17:02:27 +0000
@@ -39,7 +39,6 @@
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.datadictionary.DataDictionary;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.system.util.AuditLogLevel;
 import org.hisp.dhis.system.util.AuditLogUtil;
@@ -388,6 +387,7 @@
         return rs != null ? rs.intValue() : 0;
     }
 
+    @SuppressWarnings("unchecked")
     public Collection<UserCredentials> getUsersBetween( int first, int max )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -395,6 +395,7 @@
         return session.createQuery( "from UserCredentials" ).setFirstResult( first ).setMaxResults( max ).list();
     }
 
+    @SuppressWarnings("unchecked")
     public Collection<UserCredentials> getUsersBetweenByName( String name, int first, int max )
     {
         Session session = sessionFactory.getCurrentSession();

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceMultiDimensionTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceMultiDimensionTest.java	2010-08-31 05:47:11 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceMultiDimensionTest.java	2010-12-07 17:02:27 +0000
@@ -212,6 +212,11 @@
         // Setup OrganisationUnits
         // ---------------------------------------------------------------------
 
+        // ---------------------------------------------------------------------
+        //              A
+        //      B               C
+        // ---------------------------------------------------------------------
+
         unitA = createOrganisationUnit( 'A' );
         unitB = createOrganisationUnit( 'B', unitA );
         unitC = createOrganisationUnit( 'C', unitA );
@@ -507,6 +512,89 @@
 
     @Ignore
     @Test
+    public void testIndicatorTotal()
+    {
+        dataElementA.setType( DataElement.VALUE_TYPE_INT );
+        dataElementA.setAggregationOperator( DataElement.AGGREGATION_OPERATOR_SUM );        
+        dataElementService.updateDataElement( dataElementA );
+        
+        // ---------------------------------------------------------------------
+        // Setup DataValues
+        // ---------------------------------------------------------------------
+
+        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitB, "9", categoryOptionComboA ) );
+        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitB, "3", categoryOptionComboB ) );
+        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitC, "1", categoryOptionComboA ) );
+        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitC, "5", categoryOptionComboB ) );
+        
+        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitB, "3", categoryOptionComboA ) );
+        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitB, "2", categoryOptionComboB ) );
+        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitC, "7", categoryOptionComboA ) );
+        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitC, "9", categoryOptionComboB ) );
+        
+        // ---------------------------------------------------------------------
+        // Setup Indicators
+        // ---------------------------------------------------------------------
+
+        IndicatorType indicatorType = createIndicatorType( 'A' ); // Factor = 100
+        
+        indicatorService.addIndicatorType( indicatorType );
+        
+        Indicator indicatorA = createIndicator( 'A', indicatorType );
+
+        String suffixA = Expression.SEPARATOR + categoryOptionComboA.getId();
+        String suffixB = Expression.SEPARATOR + categoryOptionComboB.getId();
+        
+        indicatorA.setNumerator( "[" + dataElementA.getId() + suffixA + "]+[" + dataElementA.getId() + suffixB + "]" );
+        indicatorA.setNumeratorAggregationOperator( DataElement.AGGREGATION_OPERATOR_SUM );
+        
+        indicatorA.setDenominator( "100" );
+        indicatorA.setDenominatorAggregationOperator( DataElement.AGGREGATION_OPERATOR_SUM );
+
+        Indicator indicatorB = createIndicator( 'B', indicatorType );
+
+        indicatorB.setNumerator( "[" + dataElementA.getId() + "]" );
+        indicatorB.setNumeratorAggregationOperator( DataElement.AGGREGATION_OPERATOR_SUM );
+        
+        indicatorB.setDenominator( "100" );
+        indicatorB.setDenominatorAggregationOperator( DataElement.AGGREGATION_OPERATOR_SUM );
+
+        indicatorIds.add( indicatorService.addIndicator( indicatorA ) );
+        indicatorIds.add( indicatorService.addIndicator( indicatorB ) );
+
+        // ---------------------------------------------------------------------
+        // Test
+        // ---------------------------------------------------------------------
+
+        dataMartService.export( dataElementIds, indicatorIds, periodIds, organisationUnitIds );
+
+        assertEquals( 12.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodA, unitB ) );
+        assertEquals( 5.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodB, unitB ) );
+        assertEquals( 17.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodC, unitB ) );
+        
+        assertEquals( 6.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodA, unitC ) );
+        assertEquals( 16.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodB, unitC ) );
+        assertEquals( 22.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodC, unitC ) );
+        
+        assertEquals( 18.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodA, unitA ) );
+        assertEquals( 21.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodB, unitA ) );
+        assertEquals( 39.0, aggregatedDataValueService.getAggregatedValue( indicatorB, periodC, unitA ) );
+        
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodA, unitB ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodA, unitB ) );
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodB, unitB ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodB, unitB ) );
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodC, unitB ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodC, unitB ) );
+        
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodA, unitC ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodA, unitC ) );
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodB, unitC ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodB, unitC ) );
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodC, unitC ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodC, unitC ) );
+        
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodA, unitA ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodA, unitA ) );
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodB, unitA ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodB, unitA ) );
+        assertEquals( aggregatedDataValueService.getAggregatedValue( indicatorB, periodC, unitA ), aggregatedDataValueService.getAggregatedValue( indicatorA, periodC, unitA ) );
+    }
+    
+    @Ignore
+    @Test
     public void testAnnualizedIndicator()
     {
         dataElementA.setType( DataElement.VALUE_TYPE_INT );

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.html'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.html	2010-11-22 20:47:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.html	2010-12-07 17:02:27 +0000
@@ -2,7 +2,7 @@
 <html>
     <head>
         <title>DHIS 2</title>        
-        <script type="text/javascript" src="../javascripts/jQuery/jquery.js"></script>
+        <script type="text/javascript" src="../javascripts/jQuery/jquery.min.js"></script>
         <script type="text/javascript">
             $(document).ready(function() {
                 $('#j_username').focus();

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginfailed.html'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginfailed.html	2010-11-22 20:47:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginfailed.html	2010-12-07 17:02:27 +0000
@@ -2,7 +2,7 @@
 <html>
     <head>
         <title>DHIS 2</title>
-        <script type="text/javascript" src="../javascripts/jQuery/jquery.js"></script>
+        <script type="text/javascript" src="../javascripts/jQuery/jquery.min.js"></script>
         <script type="text/javascript">
             $(document).ready(function() {
                 $('#j_username').focus();

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java	2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOperandsAction.java	2010-12-07 17:02:27 +0000
@@ -97,6 +97,13 @@
         this.aggregationOperator = aggregationOperator;
     }
 
+    private boolean includeTotals = false;
+    
+    public void setIncludeTotals( boolean includeTotals )
+    {
+        this.includeTotals = includeTotals;
+    }
+
     public List<DataElementOperand> operands;
 
     public List<DataElementOperand> getOperands()
@@ -133,7 +140,7 @@
             dataElements.retainAll( dataElementService.getDataElementsByAggregationOperator( aggregationOperator ) );
         }
 
-        operands = new ArrayList<DataElementOperand>( dataElementCategoryService.getOperands( dataElements ) );
+        operands = new ArrayList<DataElementOperand>( dataElementCategoryService.getOperands( dataElements, includeTotals ) );
 
         Collections.sort( operands, new DataElementOperandNameComparator() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm	2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorExpressionBuilderForm.vm	2010-12-07 17:02:27 +0000
@@ -71,9 +71,6 @@
 </div>
 
 <script>
-
-	
-
 	var numerator = false;	
 	var validator = null;
 	var dialog = null;
@@ -106,11 +103,10 @@
 		setFieldValue( 'indicator-expression-container input[id=description]', description );
 		setRadioValue( 'aggregationOperator', aggregationOperator );
 		
-		checAggregationOperator();
+		checkAggregationOperator();
 		getExpressionText();
 		dialog.dialog("option", "title", "$i18n.getString( 'edit_numerator' )");
-		dialog.dialog( "open");
-		
+		dialog.dialog( "open");		
 	}
 	
 	function indicatorDenominatorForm()
@@ -128,7 +124,7 @@
 		setFieldValue( 'indicator-expression-container input[id=description]', description );
 		setRadioValue( 'aggregationOperator', aggregationOperator );
 		
-		checAggregationOperator();
+		checkAggregationOperator();
 		getExpressionText();
 		
 		dialog.dialog("option", "title", "$i18n.getString( 'edit_denominator' )");
@@ -141,14 +137,14 @@
 		
 		var id = getFieldValue( "indicator-expression-container select[id=dataElementGroupId]");
 		
-		loadOperands( "#indicator-expression-container select[id=dataElementId]", {id: id, aggregationOperator: aggregationOperator} );	
+		loadOperands( "#indicator-expression-container select[id=dataElementId]", {"id": id, "aggregationOperator": aggregationOperator, "includeTotals":true} );	
 		
-		checAggregationOperator();
+		checkAggregationOperator();
 	}	
 	
 	function getExpressionText()
 	{
-		if( hasText('expression') ){
+		if ( hasText('expression') ){
 			jQuery.postJSON( '../dhis-web-commons-ajax-json/getExpressionText.action', {
 				expression: getFieldValue('expression')
 			}, function( json ){
@@ -159,7 +155,7 @@
 					jQuery( "#formulaText").html( '' );
 				}
 			});
-		}else{
+		} else{
 			jQuery( "#formulaText").html( '' );
 		}
 	}
@@ -168,22 +164,26 @@
 	{
 		insertTextCommon( inputAreaName, inputText );	
 
-		checAggregationOperator();
+		checkAggregationOperator();
 		
 		getExpressionText();
 	}
 	
 	function cleanExpression()
 	{
-		checAggregationOperator();
+		checkAggregationOperator();
 		
 		getExpressionText();
 	}
 	
-	function checAggregationOperator()
+	function checkAggregationOperator()
 	{
-		if( hasText('expression') )disableGroup( "input[name=aggregationOperator]" );
-		else enableGroup( "input[name=aggregationOperator]" );
+		if ( hasText('expression') ) {
+			disableGroup( "input[name=aggregationOperator]" );
+		}
+		else {
+			enableGroup( "input[name=aggregationOperator]" );
+		}
 	}
 	
 	function closeExpressionBuilder()
@@ -214,17 +214,12 @@
 					
 					closeExpressionBuilder();
 				}
-				
-				
-			});		
-		
+			});	
 	}
 	
 	jQuery( document ).ready( function(){
 		validator = validation( 'indicator-expression-form', insertExpression );
-	});
-
-	
+	});	
 </script>