Mercurial > gemma
changeset 4700:a0c320d89682
FA diagram: take latest available LDC.
As we have to take currently not active bottlenecks into account:
don't use the current LDC (which might not be available), but the
latest available one.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 16 Oct 2019 16:50:36 +0200 |
parents | 8b6ffd9d0b18 |
children | ef2cf9c413e9 |
files | pkg/controllers/bottlenecks.go |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/bottlenecks.go Wed Oct 16 16:49:03 2019 +0200 +++ b/pkg/controllers/bottlenecks.go Wed Oct 16 16:50:36 2019 +0200 @@ -84,8 +84,9 @@ FROM waterway.gauges_reference_water_levels grwl JOIN waterway.bottlenecks bns ON grwl.location = bns.gauge_location - AND grwl.validity @> current_timestamp -WHERE bns.validity @> current_timestamp + AND grwl.validity @> COALESCE(upper(bns.validity), current_timestamp) +WHERE lower(bns.validity) = (SELECT max(lower(validity)) + FROM waterway.bottlenecks WHERE objnam = $1) AND bns.objnam = $1 AND grwl.depth_reference like 'LDC%' `