changeset 4102:3d2f02c16765 request_hist_bns

Request historic bottleneck data from SOAP service
author Tom Gottfried <tom@intevation.de>
date Fri, 26 Jul 2019 13:46:55 +0200
parents 7afe411eeb48
children 861760675497
files pkg/imports/bn.go pkg/soap/ifbn/service.go
diffstat 2 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/bn.go	Fri Jul 26 12:53:01 2019 +0200
+++ b/pkg/imports/bn.go	Fri Jul 26 13:46:55 2019 +0200
@@ -24,6 +24,7 @@
 	"strings"
 	"time"
 
+	"gemma.intevation.de/gemma/pkg/common"
 	"gemma.intevation.de/gemma/pkg/pgxutils"
 	"gemma.intevation.de/gemma/pkg/soap/ifbn"
 	"github.com/jackc/pgx/pgtype"
@@ -295,7 +296,9 @@
 	fetch := func() ([]*ifbn.BottleNeckType, error) {
 		client := ifbn.NewIBottleneckService(bn.URL, bn.Insecure, nil)
 
-		req := &ifbn.Export_bn_by_isrs{}
+		req := &ifbn.Export_bn_by_isrs{
+			Period: &ifbn.RequestedPeriod{Date_start: &time.Time{}},
+		}
 
 		resp, err := client.Export_bn_by_isrs(req)
 		if err != nil {
@@ -446,8 +449,13 @@
 		if t, ok := fromTo[toKey]; ok {
 			tto.Set(t)
 			uBound = pgtype.Exclusive
+			feedback.Info("Valid from %s to %s",
+				fromTo[fromKey].Format(common.TimeFormat),
+				fromTo[toKey].Format(common.TimeFormat))
 		} else {
 			uBound = pgtype.Unbounded
+			feedback.Info("Valid from %s",
+				fromTo[fromKey].Format(common.TimeFormat))
 		}
 	}
 
--- a/pkg/soap/ifbn/service.go	Fri Jul 26 12:53:01 2019 +0200
+++ b/pkg/soap/ifbn/service.go	Fri Jul 26 13:46:55 2019 +0200
@@ -36,7 +36,6 @@
 }
 
 type Export_bn_by_isrs struct {
-	//XMLName xml.Name `xml:"http://www.ris.eu/bottleneck/3.0 export_bn_by_isrs"`
 	XMLName xml.Name `xml:"http://www.ris.eu/bottleneck/3.0 export_bn_by_isrs"`
 
 	ISRS *ArrayOfISRSPair `xml:"ISRS,omitempty"`
@@ -826,13 +825,11 @@
 }
 
 type RequestedPeriod struct {
-	//XMLName xml.Name `xml:"http://www.ris.eu/wamos/common/3.0 RequestedPeriod"`
-
-	Date_start time.Time `xml:"Date_start,omitempty"`
+	Date_start *time.Time `xml:"http://www.ris.eu/wamos/common/3.0 Date_start,omitempty"`
 
-	Date_end time.Time `xml:"Date_end,omitempty"`
+	Date_end *time.Time `xml:"http://www.ris.eu/wamos/common/3.0 Date_end,omitempty"`
 
-	Value_interval int32 `xml:"Value_interval,omitempty"`
+	Value_interval *int32 `xml:"http://www.ris.eu/wamos/common/3.0 Value_interval,omitempty"`
 }
 
 type ArrayOfString struct {