← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2339: Displaying only 1 decimal in validation rule violations. There might be decimal numbers here sinc...

 

------------------------------------------------------------
revno: 2339
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2010-12-11 19:52:11 +0100
message:
  Displaying only 1 decimal in validation rule violations. There might be decimal numbers here since the validation formula can include multiplication with percentages etc.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.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-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2010-12-03 16:15:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2010-12-11 18:52:11 +0000
@@ -65,6 +65,8 @@
 {
     private static final Log log = LogFactory.getLog( DefaultValidationRuleService.class );
     
+    private static final int DECIMALS = 1;
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -319,7 +321,7 @@
     
                     if ( violation )
                     {
-                        validationResults.add( new ValidationResult( period, source, validationRule, leftSide, rightSide ) );
+                        validationResults.add( new ValidationResult( period, source, validationRule, MathUtils.getRounded( leftSide, DECIMALS ), MathUtils.getRounded( rightSide, DECIMALS ) ) );
                     }
                 }
             }