From 4a2407d9b9d6484d53ed3b60a573ebf4782c9964 Mon Sep 17 00:00:00 2001 From: Vladimir Simakhin Date: Wed, 20 Sep 2023 18:59:59 +0200 Subject: [PATCH] case insensetive filters on the Map page --- CHANGELOG.md | 1 + cmd/web/helpers.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bebc0b2..df6f986 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Update: ignore case for filters on the `Map` page - Fix: The filter on the `Map` page wasn't working correctly if there was a space in the fields - Update: Show the total number of rows for most of the tables (Logbook, Licensing, Airports) - New: Date Range Picker first day of the week settings - Sunday or Monday. diff --git a/cmd/web/helpers.go b/cmd/web/helpers.go index 4f81db2..bbc44c5 100644 --- a/cmd/web/helpers.go +++ b/cmd/web/helpers.go @@ -98,13 +98,13 @@ func (app *application) isFlightRecordHelpEnabled() bool { return !settings.DisableFlightRecordHelp } -// parameterFilter is some custom string compare function +// parameterFilter is a custom string case insensetive compare function func parameterFilter(s string, substr string) bool { if strings.TrimSpace(s) == "" { return true } - return strings.Contains(s, substr) + return strings.Contains(strings.ToLower(s), strings.ToLower(substr)) } func parameterClassFilter(classes map[string]string, model string, filter string) bool {