[Suiviobsmer-commits] r709 - in trunk: wao-business/src/main/java/fr/ifremer/wao/bean wao-ui/src/main/webapp
Author: bleny Date: 2010-10-25 09:29:41 +0000 (Mon, 25 Oct 2010) New Revision: 709 Log: bugfix global synthesis average calculus Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java trunk/wao-ui/src/main/webapp/Synthesis.tml Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java 2010-10-22 17:00:26 UTC (rev 708) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/GlobalSynthesisResultImpl.java 2010-10-25 09:29:41 UTC (rev 709) @@ -59,19 +59,29 @@ @Override public GlobalIndicatorValue getGlobalLevel() { // compute an average with coefficients - double totalValues = 0.0; + double totalLevels = 0.0; double totalCoefficients = 0.0; for (Indicator indicator : globalSynthesisParameters) { - Double value = values.get(indicator.getSynthesisId()); - Double coefficient = indicator.getCoefficient(); + double value = values.get(indicator.getSynthesisId()); + double level = indicator.getLevelForValue(value).getLevel(); + double coefficient = indicator.getCoefficient(); - totalValues += value * coefficient; + totalLevels += level * coefficient; totalCoefficients += coefficient; + + if (log.isDebugEnabled()) { + log.debug("totalLevels = " + totalLevels + + ", totalCoefficients = " + totalCoefficients); + } } - double value = totalValues / totalCoefficients; + double value = totalLevels / totalCoefficients; + if (log.isDebugEnabled()) { + log.debug("value for global indicator = " + value); + } + GlobalIndicatorValue result = null; if (value >= 1.0 && value < 2.0) { result = GlobalIndicatorValue.VERY_BAD; Modified: trunk/wao-ui/src/main/webapp/Synthesis.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-22 17:00:26 UTC (rev 708) +++ trunk/wao-ui/src/main/webapp/Synthesis.tml 2010-10-25 09:29:41 UTC (rev 709) @@ -362,7 +362,7 @@ <t:indicatorLevels t:indicator="activeIndicator" t:highlightLevel="activeIndicatorLevel" /> </t:loop> - BILAN + Bilan de la synthèse globale : ${globalSynthesisResult.globalLevel} </div> </t:block> </t:layout>
participants (1)
-
bleny@users.labs.libre-entreprise.org