Mercurial > gemma
diff pkg/imports/bn.go @ 3423:6592396f5061
Make revisiting time of a bottleneck optional
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 23 May 2019 15:33:56 +0200 |
parents | ec6163c6687d |
children | b9e331c1e616 |
line wrap: on
line diff
--- a/pkg/imports/bn.go Thu May 23 15:33:23 2019 +0200 +++ b/pkg/imports/bn.go Thu May 23 15:33:56 2019 +0200 @@ -146,14 +146,6 @@ return &m[1], &m[2] } -func revisitingTime(s string) int { - v, err := strconv.Atoi(s) - if err != nil { - v = 0 - } - return v -} - // Do executes the actual bottleneck import. func (bn *Bottleneck) Do( ctx context.Context, @@ -275,6 +267,17 @@ rb, lb := splitRBLB(bn.Rb_lb) + var revisitingTime *int + if bn.Revisiting_time != nil { + i, err := strconv.Atoi(*bn.Revisiting_time) + if err != nil { + feedback.Warn("Cannot convert '%s' to number of months", + *bn.Revisiting_time) + } else { + revisitingTime = &i + } + } + var limiting, country string if bn.Limiting_factor != nil { @@ -297,7 +300,7 @@ rb, lb, country, - revisitingTime(bn.Revisiting_time), + revisitingTime, limiting, bn.Date_Info, bn.Source,