Fix age min/max filter on search page

This commit is contained in:
Noah Petherbridge 2023-09-10 12:07:16 -07:00
parent 1e7ea6830c
commit 7d3e04b869

View File

@ -39,13 +39,11 @@ func Search() http.HandlerFunc {
friendSearch = r.FormValue("friends") == "true"
sort = r.FormValue("sort")
sortOK bool
ageMin int
ageMax int
)
ageMin, _ = strconv.Atoi(r.FormValue("age_min"))
ageMax, _ = strconv.Atoi(r.FormValue("age_max"))
if ageMin > ageMax {
ageMin, err1 := strconv.Atoi(r.FormValue("age_min"))
ageMax, err2 := strconv.Atoi(r.FormValue("age_max"))
if ageMin > ageMax && err1 == nil && err2 == nil {
ageMin, ageMax = ageMax, ageMin
}