# HG changeset patch # User Sascha L. Teichmann # Date 1367946428 -7200 # Node ID d6bf8353e0fced47941b7562e17d92a1ade0771e # Parent 4fafe8d147b2a815f7a57c030f2ddcb99d1693af Historical discharge curves: Do not add calculation relevant curve into list of available curves. diff -r 4fafe8d147b2 -r d6bf8353e0fc artifacts/src/main/java/org/dive4elements/river/artifacts/services/DischargeInfoService.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DischargeInfoService.java Tue May 07 18:19:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DischargeInfoService.java Tue May 07 19:07:08 2013 +0200 @@ -50,13 +50,15 @@ GlobalContext globalContext, CallMeta callMeta ) { - logger.debug("DischargeInfoService.process"); - logger.debug(XMLUtils.toString(data)); + if (logger.isDebugEnabled()) { + logger.debug("DischargeInfoService.process"); + logger.debug(XMLUtils.toString(data)); + } String gaugeNumber = XMLUtils.xpathString( data, GAUGE_XPATH, ArtifactNamespaceContext.INSTANCE); - if(gaugeNumber == null || + if (gaugeNumber == null || (gaugeNumber = gaugeNumber.trim()).length() == 0) { logger.warn("No gauge specified. Cannot return discharge info."); return XMLUtils.newDocument(); @@ -74,6 +76,10 @@ } Gauge gauge = Gauge.getGaugeByOfficialNumber(gn); + if (gauge == null) { + logger.warn("No such gauge found."); + return XMLUtils.newDocument(); + } logger.debug("Found gauge: " + gauge.getName()); @@ -87,6 +93,8 @@ List tables = gauge.getDischargeTables(); Collections.sort(tables); + logger.debug("# of tables:" + tables.size()); + Element all = result.createElement("discharges"); for (DischargeTable dt: tables) { if (dt.getKind() == DischargeTables.MASTER) { diff -r 4fafe8d147b2 -r d6bf8353e0fc artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeTimerangeState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeTimerangeState.java Tue May 07 18:19:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeTimerangeState.java Tue May 07 19:07:08 2013 +0200 @@ -47,7 +47,7 @@ "SELECT min(start_time) as min, max(stop_time) as max " + "FROM time_intervals WHERE id in " + "(SELECT time_interval_id FROM discharge_tables " + - "WHERE gauge_id =:gid)"); + "WHERE kind <> 0 and gauge_id =:gid)"); query.addScalar("min", StandardBasicTypes.CALENDAR); query.addScalar("max", StandardBasicTypes.CALENDAR);