[PATCH] (issue1448) Look through all the data for sq_ti_id in following states

Wald Commits scm-commit at wald.intevation.org
Mon Sep 8 18:31:21 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410193877 -7200
# Node ID c0da2514f4ce99be6228ed485fbffcc66218f2dd
# Parent  b6371be363b1459e20936fdcd09937ebfbae2f93
(issue1448) Look through all the data for sq_ti_id in following states.

diff -r b6371be363b1 -r c0da2514f4ce gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java	Mon Sep 08 17:52:52 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadEpochPanel.java	Mon Sep 08 18:31:17 2014 +0200
@@ -254,16 +254,19 @@
         String river = artifact.getArtifactDescription().getRiver();
 
         String sq_ti_id = "";
-        if (data.length > 0) {
-            Data str = getData(data[0].getAll(), "sq_ti_id");
+        for (int i = 0; i < data.length; i++) {
+            Data str = getData(data[i].getAll(), "sq_ti_id");
             if (str != null) {
                 DataItem[] strItems = str.getItems();
                 sq_ti_id = strItems[0].getStringValue();
-            } else {
-                GWT.log("Failed to find sq time interval id in data.");
+                break;
             }
         }
 
+        if (sq_ti_id.isEmpty()){
+            GWT.log("Failed to find sq time interval id in data.");
+        }
+
         sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id,
             new AsyncCallback<SedimentLoadInfoObject[]>() {
                 public void onFailure(Throwable caught) {
diff -r b6371be363b1 -r c0da2514f4ce gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java	Mon Sep 08 17:52:52 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadPeriodPanel.java	Mon Sep 08 18:31:17 2014 +0200
@@ -207,16 +207,19 @@
         String river = artifact.getArtifactDescription().getRiver();
 
         String sq_ti_id = "";
-        if (data.length > 0) {
-            Data str = getData(data[0].getAll(), "sq_ti_id");
+        for (int i = 0; i < data.length; i++) {
+            Data str = getData(data[i].getAll(), "sq_ti_id");
             if (str != null) {
                 DataItem[] strItems = str.getItems();
                 sq_ti_id = strItems[0].getStringValue();
-            } else {
-                GWT.log("Failed to find sq time interval id in data.");
+                break;
             }
         }
 
+        if (sq_ti_id.isEmpty()){
+            GWT.log("Failed to find sq time interval id in data.");
+        }
+
         sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id,
             new AsyncCallback<SedimentLoadInfoObject[]>() {
                 public void onFailure(Throwable caught) {


More information about the Dive4Elements-commits mailing list