Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java @ 4066:f02aa4ff3c0f
S/Q relation: Fixed problem with loosing meassurement points.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Tue, 09 Oct 2012 19:02:39 +0200 |
parents | 60d88ec49c3b |
children | 0df2247d98e1 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java Tue Oct 09 12:30:13 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java Tue Oct 09 19:02:39 2012 +0200 @@ -9,6 +9,8 @@ import java.util.Map; import java.util.TreeMap; +import org.apache.log4j.Logger; + import org.hibernate.SQLQuery; import org.hibernate.Session; @@ -22,6 +24,9 @@ public class MeasurementFactory { + private static final Logger log = + Logger.getLogger(MeasurementFactory.class); + public static final String SQL_TOTALS = "SELECT " + "m.Q_BPEGEL AS Q_BPEGEL,"+ @@ -215,6 +220,8 @@ double location, DateRange dateRange ) { + boolean debug = log.isDebugEnabled(); + SQLQuery query = session.createSQLQuery(SQL_FACTIONS) .addScalar("Q_BPEGEL", StandardBasicTypes.DOUBLE) .addScalar("DATUM", StandardBasicTypes.DATE) @@ -280,6 +287,10 @@ @SuppressWarnings("unchecked") List<Measurement> measuments = (List<Measurement>)query.list(); + if (debug) { + log.debug("num fraction results: " + measuments.size()); + } + List<Measurement> same = new ArrayList<Measurement>(); Integer lastLR = null; @@ -298,6 +309,8 @@ same.clear(); } + same.add(m); + lastLR = currentLR; } @@ -309,7 +322,17 @@ m.adjustSieves(); } - return separateByDate(accumulated); + if (debug) { + log.debug("Before date separation: " + accumulated.size()); + } + + accumulated = separateByDate(accumulated); + + if (debug) { + log.debug("After date separation: " + accumulated.size()); + } + + return accumulated; } protected static List<Measurement> separateByDate(List<Measurement> measurements) {