changeset 5685:756df79274e1

SedimentLoadCalculation: Partly fix 1250 (calculate more than one total if possible).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 12 Apr 2013 16:51:52 +0200 (2013-04-12)
parents 88cbe798cbab
children efe1ab205a95
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadCalculation.java
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadCalculation.java	Fri Apr 12 16:13:23 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadCalculation.java	Fri Apr 12 16:51:52 2013 +0200
@@ -256,22 +256,29 @@
 
     private SedimentLoad calculateTotalLoad(SedimentLoad load, int year) {
         logger.debug("calculateTotalLoad");
+        boolean problemThisYear = false;
         if (!load.hasCoarse()) {
-            addProblem(year, "missing.fraction.coarse");
+            addProblem("missing.fraction.coarse", Double.toString(year));
+            problemThisYear = true;
         }
         if (!load.hasFineMiddle()) {
-            addProblem(year, "missing.fraction.fine_middle");
+            addProblem("missing.fraction.fine_middle", Double.toString(year));
+            problemThisYear = true;
         }
         if (!load.hasSand()) {
-            addProblem(year, "missing.fraction.sand");
+            addProblem("missing.fraction.sand", Double.toString(year));
+            problemThisYear = true;
         }
         if (!load.hasSuspSand()) {
-            addProblem(year, "missing.fraction.susp_sand");
+            addProblem("missing.fraction.susp_sand", Double.toString(year));
+            problemThisYear = true;
         }
         if (!load.hasSuspSediment()) {
-            addProblem(year, "missing.fraction.susp_sediment");
+            addProblem("missing.fraction.susp_sediment", Double.toString(year));
+            problemThisYear = true;
         }
-        if (hasProblems()) {
+        if (problemThisYear) {
+            logger.warn("Some problem, not calculating total load.");
             return load;
         }
         for(double km : load.getKms()) {

http://dive4elements.wald.intevation.org