Make partial report suggestion handle hyphens
This commit is contained in:
parent
f6f54da305
commit
500659be4a
1 changed files with 7 additions and 1 deletions
|
|
@ -30,7 +30,7 @@ func getReportSuggestion(w http.ResponseWriter, r *http.Request) {
|
||||||
respondError(w, "You need at least a bit of an 'r'", nil, http.StatusBadRequest)
|
respondError(w, "You need at least a bit of an 'r'", nil, http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p := strings.ToUpper(partial_report_id) + "%"
|
p := partialSearchParam(partial_report_id)
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
rows, err := sql.PublicreportPublicIDSuggestion(p).All(ctx, db.PGInstance.BobDB)
|
rows, err := sql.PublicreportPublicIDSuggestion(p).All(ctx, db.PGInstance.BobDB)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -133,3 +133,9 @@ func parseLatLng(r *http.Request) (LatLngForm, error) {
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func partialSearchParam(p string) string {
|
||||||
|
result := strings.ReplaceAll(p, "-", "")
|
||||||
|
result = strings.ToUpper(result)
|
||||||
|
return result + "%"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue