comparison pkg/controllers/surveys.go @ 5575:6709530f002e surveysperbottleneckid

surveys endpoint: enforce query parameters. Get rid of unnecessary else-clause
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 21 Jul 2021 15:14:40 +0200
parents 271888ef85bc
children 0011f50cf216
comparison
equal deleted inserted replaced
5574:271888ef85bc 5575:6709530f002e
71 71
72 if date == "" && bottleneckName == "" && id != "" { 72 if date == "" && bottleneckName == "" && id != "" {
73 rows, err = mw.JSONConn(req).QueryContext(req.Context(), listSurveysByIdSQL, id) 73 rows, err = mw.JSONConn(req).QueryContext(req.Context(), listSurveysByIdSQL, id)
74 } else if date != "" && bottleneckName != "" && id == "" { 74 } else if date != "" && bottleneckName != "" && id == "" {
75 rows, err = mw.JSONConn(req).QueryContext(req.Context(), listSurveysByNameDateSQL, bottleneckName, date) 75 rows, err = mw.JSONConn(req).QueryContext(req.Context(), listSurveysByNameDateSQL, bottleneckName, date)
76 } else {
77 jr = mw.JSONResult{
78 Result: struct {
79 Surveys []*models.Survey `json:"surveys"`
80 }{surveys},
81 }
82 return
83 } 76 }
84 if err != nil { 77 if err != nil {
85 return 78 return
86 } 79 }
87 defer rows.Close() 80 defer rows.Close()