Mercurial > gemma
changeset 4529:2077347ef345
Fixed bottleneck selection in AF diagrams for section/stretch.
Before this fix only currently active bottlenecks were taken into
account, that was wrong, as we are creating diagrams for time ranges
in the past, where other BN might have been active.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Tue, 08 Oct 2019 18:22:51 +0200 |
parents | 0bad1dcdb044 |
children | ffa3148b95c5 9cd00133dff9 |
files | pkg/controllers/stretches.go |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/controllers/stretches.go Tue Oct 08 12:45:35 2019 +0200 +++ b/pkg/controllers/stretches.go Tue Oct 08 18:22:51 2019 +0200 @@ -31,14 +31,21 @@ "gemma.intevation.de/gemma/pkg/middleware" ) +// The following requests are taking _all_ bottlenecks into account, not only +// the currently valid ones. This is neccessary, as we are doing reports on +// arbitrary time ranges and bottlenecks currently active might have been in the +// selected time range. +// +// FIXME: the better solution would be to limit the bottlenecks to those with: +// b.validity && REQUESTED_TIME_RANGE + const ( selectSectionBottlenecks = ` SELECT distinct(b.objnam), b.limiting FROM waterway.sections s, waterway.bottlenecks b -WHERE b.validity @> current_timestamp - AND ST_Intersects(b.area, s.area) +WHERE ST_Intersects(b.area, s.area) AND s.name = $1` selectStretchBottlenecks = ` @@ -46,8 +53,7 @@ distinct(b.objnam), b.limiting FROM users.stretches s, waterway.bottlenecks b -WHERE b.validity @> current_timestamp - AND ST_Intersects(b.area, s.area) +WHERE ST_Intersects(b.area, s.area) AND s.name = $1` )