changeset 2250:40608c82e9cb

Bugfix: create a report facet for historical discharge curves even if no data has been computed. flys-artifacts/trunk@3899 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 03 Feb 2012 13:46:03 +0000 (2012-02-03)
parents 997df76c6f58
children c9c788eea200
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java
diffstat 3 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Feb 03 13:42:48 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Feb 03 13:46:03 2012 +0000
@@ -1,3 +1,13 @@
+2012-02-03  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/Calculation6.java: Use
+	  the current date for discharge tables which doesn't have a stop time set.
+	  A warning message is written to log.
+
+	* src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java:
+	  Generate report facet before leaving the computeXXX() method when no
+	  calculation results has been computed.
+
 2012-02-03  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/utils/FLYSUtils.java: Added a function
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java	Fri Feb 03 13:42:48 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java	Fri Feb 03 13:46:03 2012 +0000
@@ -53,6 +53,8 @@
 
         WQTimerange[] wqt = prepareCalculationData(dts);
 
+        logger.debug("Number of calculation results: " + wqt.length);
+
         return new CalculationResult(wqt, this);
     }
 
@@ -131,6 +133,12 @@
                 Date start = ti.getStartTime();
                 Date end   = ti.getStopTime();
 
+                if (end == null) {
+                    logger.warn("TimeInterval has no stop time set!");
+
+                    end = new Date();
+                }
+
                 Timerange t = new Timerange(ti.getStartTime(),ti.getStopTime());
                 double    w;
                 double    q;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java	Fri Feb 03 13:42:48 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java	Fri Feb 03 13:46:03 2012 +0000
@@ -66,6 +66,10 @@
             return res;
         }
 
+        if (res.getReport().hasProblems()) {
+            facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
+        }
+
         WQTimerange[] data = (WQTimerange[]) res.getData();
         if (data == null || data.length == 0) {
             logger.warn("Historical Discharge calculation has no results!");
@@ -74,10 +78,6 @@
 
         prepareFacets(facets, data);
 
-        if (res.getReport().hasProblems()) {
-            facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
-        }
-
         return res;
     }
 

http://dive4elements.wald.intevation.org