Only parse lat/lng if present
This commit is contained in:
parent
527f6a5628
commit
a93b921103
1 changed files with 14 additions and 8 deletions
22
rmo/quick.go
22
rmo/quick.go
|
|
@ -134,15 +134,21 @@ func postQuick(w http.ResponseWriter, r *http.Request) {
|
|||
lng := r.FormValue("longitude")
|
||||
comments := r.FormValue("comments")
|
||||
|
||||
latitude, err := strconv.ParseFloat(lat, 64)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to create parse latitude", err, http.StatusBadRequest)
|
||||
return
|
||||
var latitude float64
|
||||
if lat != "" {
|
||||
latitude, err = strconv.ParseFloat(lat, 64)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to parse latitude", err, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
longitude, err := strconv.ParseFloat(lng, 64)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to create parse longitude", err, http.StatusBadRequest)
|
||||
return
|
||||
var longitude float64
|
||||
if lng != "" {
|
||||
longitude, err = strconv.ParseFloat(lng, 64)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to parse longitude", err, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
}
|
||||
u, err := report.GenerateReportID()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue