changeset 3790:6546c0bbc6f9

Backend: 'Pegelinfo' needs min/max Q, too. flys-backend/trunk@5417 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 10 Sep 2012 09:50:43 +0000
parents 9f92c42b7a81
children e72c7fe202dd
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/Gauge.java
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Mon Sep 10 08:20:50 2012 +0000
+++ b/flys-backend/ChangeLog	Mon Sep 10 09:50:43 2012 +0000
@@ -1,3 +1,8 @@
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/Gauge.java:
+	  We need min/max Q, too.
+
 2012-09-10	Björn Ricks <bjoern.ricks@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/MinMaxWQ.java,
--- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Mon Sep 10 08:20:50 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Mon Sep 10 09:50:43 2012 +0000
@@ -297,26 +297,25 @@
             "from MainValue as mv " +
             "join mv.mainValue as nmv " +
             "join nmv.type mvt " +
-            "where mvt.name = 'W' and mv.gauge.id = :gauge_id " +
+            "where mvt.name in ('W', 'Q') " +
+            "and mv.gauge.id = :gauge_id " +
             "group by mvt.name order by mvt.name"
             );
 
         query.setParameter("gauge_id", getId());
 
         List<Object> results = query.list();
-        if (results.size() == 0) {
+        if (results.isEmpty()) {
             // No values found
             return new MinMaxWQ();
         }
 
-        BigDecimal maxw;
-        BigDecimal minw;
+        Object[] arr = (Object[]) results.get(0);
+        BigDecimal maxw = (BigDecimal)arr[0];
+        BigDecimal minw = (BigDecimal)arr[1];
         BigDecimal maxq = null;
         BigDecimal minq = null;
 
-        Object[] arr = (Object[]) results.get(0);
-        maxw = (BigDecimal)arr[0];
-        minw = (BigDecimal)arr[1];
 
         if (results.size() > 1) {
             arr = (Object[]) results.get(1);

http://dive4elements.wald.intevation.org