Mercurial > gemma
comparison pkg/controllers/importqueue.go @ 4078:80bdcd137a1d timezone
Parse timezones from time inputs and send timezones in results.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 25 Jul 2019 15:43:13 +0200 |
parents | 6521c962a7b6 |
children | 350a24c92848 |
comparison
equal
deleted
inserted
replaced
4075:cb74aa69954e | 4078:80bdcd137a1d |
---|---|
25 "time" | 25 "time" |
26 | 26 |
27 "github.com/gorilla/mux" | 27 "github.com/gorilla/mux" |
28 | 28 |
29 "gemma.intevation.de/gemma/pkg/auth" | 29 "gemma.intevation.de/gemma/pkg/auth" |
30 "gemma.intevation.de/gemma/pkg/common" | |
30 "gemma.intevation.de/gemma/pkg/imports" | 31 "gemma.intevation.de/gemma/pkg/imports" |
31 "gemma.intevation.de/gemma/pkg/models" | 32 "gemma.intevation.de/gemma/pkg/models" |
32 ) | 33 ) |
33 | 34 |
34 const ( | 35 const ( |
134 ids := toInt8Array(idss) | 135 ids := toInt8Array(idss) |
135 cond(" id = ANY($%d) ", ids) | 136 cond(" id = ANY($%d) ", ids) |
136 } | 137 } |
137 | 138 |
138 if from := req.FormValue("from"); from != "" { | 139 if from := req.FormValue("from"); from != "" { |
139 fromTime, err := time.Parse(models.ImportTimeFormat, from) | 140 fromTime, err := common.ParseTime(from) |
140 if err != nil { | 141 if err != nil { |
141 return nil, nil, nil, err | 142 return nil, nil, nil, err |
142 } | 143 } |
143 l = append(l, buildFilterTerm("enqueued >= $%d", fromTime)) | 144 l = append(l, buildFilterTerm("enqueued >= $%d", fromTime)) |
144 b = append(b, buildFilterTerm("enqueued < $%d", fromTime)) | 145 b = append(b, buildFilterTerm("enqueued < $%d", fromTime)) |
145 } else { | 146 } else { |
146 noBefore = true | 147 noBefore = true |
147 } | 148 } |
148 | 149 |
149 if to := req.FormValue("to"); to != "" { | 150 if to := req.FormValue("to"); to != "" { |
150 toTime, err := time.Parse(models.ImportTimeFormat, to) | 151 toTime, err := common.ParseTime(to) |
151 if err != nil { | 152 if err != nil { |
152 return nil, nil, nil, err | 153 return nil, nil, nil, err |
153 } | 154 } |
154 l = append(l, buildFilterTerm("enqueued <= $%d", toTime)) | 155 l = append(l, buildFilterTerm("enqueued <= $%d", toTime)) |
155 a = append(a, buildFilterTerm("enqueued > $%d", toTime)) | 156 a = append(a, buildFilterTerm("enqueued > $%d", toTime)) |