Mercurial > gemma
changeset 1292:5aeda02c51b9
Sounding result import: Don't fail if an import ZIP does not contain an meta.json but has a full set of overrides.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 22 Nov 2018 13:37:29 +0100 |
parents | e9fb72fa6bae |
children | bcfd038b97a2 b9fd587d8ea0 |
files | pkg/imports/sr.go |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/sr.go Thu Nov 22 13:15:48 2018 +0100 +++ b/pkg/imports/sr.go Thu Nov 22 13:37:29 2018 +0100 @@ -178,7 +178,7 @@ feedback.Info("Looking for 'meta.json'") mf := common.FindInZIP(z, "meta.json") - if mf == nil { + if mf == nil && !sr.completeOverride() { return errors.New("Cannot find 'meta.json'") } @@ -298,7 +298,19 @@ return os.RemoveAll(sr.Dir) } +func (sr *SoundingResult) completeOverride() bool { + return sr.EPSG != nil && sr.Bottleneck != nil && sr.Date != nil && sr.DepthReference != nil +} + func (sr *SoundingResult) loadMeta(f *zip.File) (*models.SoundingResultMeta, error) { + if f == nil { + return &models.SoundingResultMeta{ + Date: *sr.Date, + Bottleneck: *sr.Bottleneck, + EPSG: *sr.EPSG, + DepthReference: *sr.DepthReference, + }, nil + } r, err := f.Open() if err != nil { return nil, err