# HG changeset patch # User Sascha L. Teichmann # Date 1589315733 -7200 # Node ID 8c44b518141a2a8ce4f1d8b84a64f6c13a82e863 # Parent d89f5d75223e3823e07785d95e3b9f7ec5dbdccc Don't intersect with validities when fetching bottleneck_ids for sections and stretches. diff -r d89f5d75223e -r 8c44b518141a pkg/controllers/fwa.go --- a/pkg/controllers/fwa.go Tue May 12 22:24:16 2020 +0200 +++ b/pkg/controllers/fwa.go Tue May 12 22:35:33 2020 +0200 @@ -50,8 +50,7 @@ %s s, waterway.bottlenecks b WHERE ST_Intersects(b.area, s.area) - AND s.name = $1 - AND b.validity && tstzrange($2, $3)` + AND s.name = $1` selectLDCsSQL = ` SELECT @@ -203,7 +202,7 @@ conn := middleware.GetDBConn(req) // Function to extract the bottleneck_id's from the query. - var extract func(context.Context, *sql.Conn, string, time.Time, time.Time) (bottlenecks, error) + var extract func(context.Context, *sql.Conn, string) (bottlenecks, error) switch vars["kind"] { case "bottleneck": @@ -217,7 +216,7 @@ return } - bottlenecks, err := extract(ctx, conn, name, from, to) + bottlenecks, err := extract(ctx, conn, name) if err != nil { log.Printf("error: %v\n", err) http.Error(rw, "cannot extract bottlenecks", http.StatusBadRequest) @@ -628,14 +627,12 @@ ctx context.Context, conn *sql.Conn, what, name string, - from, to time.Time, ) (bottlenecks, error) { rows, err := conn.QueryContext( ctx, fmt.Sprintf(selectSymbolBottlenecksSQL, what), - name, - from, to) + name) if err != nil { return nil, err } @@ -658,7 +655,6 @@ _ context.Context, _ *sql.Conn, name string, - _, _ time.Time, ) (bottlenecks, error) { return bottlenecks{{id: name}}, nil } @@ -667,26 +663,22 @@ ctx context.Context, conn *sql.Conn, name string, - from, to time.Time, ) (bottlenecks, error) { return loadSymbolBottlenecksFromTo( ctx, conn, - "users.stretches", name, - from, to) + "users.stretches", name) } func extractSection( ctx context.Context, conn *sql.Conn, name string, - from, to time.Time, ) (bottlenecks, error) { return loadSymbolBottlenecksFromTo( ctx, conn, - "waterway.sections", name, - from, to) + "waterway.sections", name) } func (bn *bottleneck) loadLimitingValidities(