Mercurial > gemma
diff pkg/controllers/bottlenecks.go @ 3318:753e7c8e8c95
Fixed time interval handling in waterlevel classification
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 17 May 2019 18:21:36 +0200 |
parents | deea2f15400f |
children | 4a81accd6182 |
line wrap: on
line diff
--- a/pkg/controllers/bottlenecks.go Fri May 17 17:22:09 2019 +0200 +++ b/pkg/controllers/bottlenecks.go Fri May 17 18:21:36 2019 +0200 @@ -177,7 +177,8 @@ // log.Println("complete outside") continue pairs - case p1.when.After(from) && p2.when.Before(to): + case (p1.when.Before(from) || p1.when.Equal(from)) && (to.Before(p2.when) || to.Equal(p2.when)): + //case !p1.when.After(from) && !p2.when.Before(to): // (from-to) is complete inside segment. // invalid += p1.when.Sub(from) // invalid += to.Sub(p2.when) @@ -186,7 +187,7 @@ f, _ := v(from) t, _ := v(to) classify(common.InterpolateTimeByValue(from, f, to, t)) - start, end = p1.when, p2.when + start, end = from, to case p1.when.After(from): // from is inside segment @@ -218,6 +219,7 @@ p2.when, access(p2), )) start, end = p1.when, p2.when + default: log.Printf("warn: unexpected case. That should not happen. %v - %v, %v - %v\n", p1.when, p2.when, from, to)