comparison pkg/controllers/stretches.go @ 5204:7ca9e6c9a203 new-fwa

Introduced type for mode (monthly, quarterly, yearly).
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 11 May 2020 11:03:19 +0200
parents 4847ac70103a
children 23addd19a6e2
comparison
equal deleted inserted replaced
5203:355195a90298 5204:7ca9e6c9a203
207 func stretchAvailableFairwayDepth(rw http.ResponseWriter, req *http.Request) { 207 func stretchAvailableFairwayDepth(rw http.ResponseWriter, req *http.Request) {
208 208
209 vars := mux.Vars(req) 209 vars := mux.Vars(req)
210 stretch := vars["kind"] == "stretch" 210 stretch := vars["kind"] == "stretch"
211 name := vars["name"] 211 name := vars["name"]
212 mode := intervalMode(req.FormValue("mode")) 212 mode := parseFWAMode(req.FormValue("mode"))
213 213
214 depthbreaks, widthbreaks := afdRefs, afdRefs 214 depthbreaks, widthbreaks := afdRefs, afdRefs
215 215
216 from, ok := parseFormTime(rw, req, "from", time.Now().AddDate(-1, 0, 0)) 216 from, ok := parseFormTime(rw, req, "from", time.Now().AddDate(-1, 0, 0))
217 if !ok { 217 if !ok {
458 func stretchAvailabilty(rw http.ResponseWriter, req *http.Request) { 458 func stretchAvailabilty(rw http.ResponseWriter, req *http.Request) {
459 459
460 vars := mux.Vars(req) 460 vars := mux.Vars(req)
461 stretch := vars["kind"] == "stretch" 461 stretch := vars["kind"] == "stretch"
462 name := vars["name"] 462 name := vars["name"]
463 mode := intervalMode(req.FormValue("mode")) 463 mode := parseFWAMode(req.FormValue("mode"))
464 464
465 if name == "" { 465 if name == "" {
466 http.Error( 466 http.Error(
467 rw, 467 rw,
468 fmt.Sprintf("Missing %s name", vars["kind"]), 468 fmt.Sprintf("Missing %s name", vars["kind"]),