Mercurial > gemma
comparison pkg/imports/sr.go @ 979:7934b5c1a910
Finally enqueue sounding result import job to import jobs.
Sends back the id of the job.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 19 Oct 2018 12:14:53 +0200 |
parents | 544a5cfe07cd |
children | f4f5bd73bd27 |
comparison
equal
deleted
inserted
replaced
978:544a5cfe07cd | 979:7934b5c1a910 |
---|---|
23 | 23 |
24 "gemma.intevation.de/gemma/pkg/octree" | 24 "gemma.intevation.de/gemma/pkg/octree" |
25 ) | 25 ) |
26 | 26 |
27 type SoundingResult struct { | 27 type SoundingResult struct { |
28 who string | 28 Who string |
29 dir string | 29 Dir string |
30 } | 30 } |
31 | 31 |
32 const SoundingResultDateFormat = "2006-01-02" | 32 const SoundingResultDateFormat = "2006-01-02" |
33 | 33 |
34 type ( | 34 type ( |
126 *srd = SoundingResultDate{d} | 126 *srd = SoundingResultDate{d} |
127 } | 127 } |
128 return err | 128 return err |
129 } | 129 } |
130 | 130 |
131 func (sr *SoundingResult) Who() string { | 131 func (sr *SoundingResult) User() string { |
132 return sr.who | 132 return sr.Who |
133 } | 133 } |
134 | 134 |
135 func (sr *SoundingResult) CleanUp() error { | 135 func (sr *SoundingResult) CleanUp() error { |
136 return os.RemoveAll(sr.dir) | 136 return os.RemoveAll(sr.Dir) |
137 } | 137 } |
138 | 138 |
139 func find(needle string, haystack []*zip.File) *zip.File { | 139 func find(needle string, haystack []*zip.File) *zip.File { |
140 needle = strings.ToLower(needle) | 140 needle = strings.ToLower(needle) |
141 for _, straw := range haystack { | 141 for _, straw := range haystack { |
274 return shapeToPolygon(s) | 274 return shapeToPolygon(s) |
275 } | 275 } |
276 | 276 |
277 func (sr *SoundingResult) Do(conn *sql.Conn) error { | 277 func (sr *SoundingResult) Do(conn *sql.Conn) error { |
278 | 278 |
279 z, err := zip.OpenReader(filepath.Join(sr.dir, "sr.zip")) | 279 z, err := zip.OpenReader(filepath.Join(sr.Dir, "sr.zip")) |
280 if err != nil { | 280 if err != nil { |
281 return err | 281 return err |
282 } | 282 } |
283 defer z.Close() | 283 defer z.Close() |
284 | 284 |