From f2df7c9e08815dea08f93ac87346535e642e96ac Mon Sep 17 00:00:00 2001 From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:17:35 -0800 Subject: [PATCH] updated well_tags to self alphabetize --- app/frontend/src/common/constants.js | 8 ++++++-- app/frontend/src/wells/components/mixins/filters.js | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/frontend/src/common/constants.js b/app/frontend/src/common/constants.js index 2bc325a63..1831e8c65 100644 --- a/app/frontend/src/common/constants.js +++ b/app/frontend/src/common/constants.js @@ -15,7 +15,11 @@ export const WELL_TAGS_PUBLIC = [ { text: "Well Decommission Report", value: "Well Decommission" }, { text: "Well Pump Installation Report", value: "Well Pump Installation" }, { text: "Other", value: "Additional Details" }, -] +].sort((a,b) => { + if(a.text === 'Other') return 1; + if(b.text === 'Other') return -1; + a.text.toLowerCase().localeCompare(b.text.toLowerCase()) +}) export const WELL_TAGS_PRIVATE = [ { text: "Alternative Specifications", value: "Alternative Specs" }, @@ -26,7 +30,7 @@ export const WELL_TAGS_PRIVATE = [ { text: "Signed Sharing Agreement", value: "Sharing Agreement" }, { text: "Water Quality Report", value: "Water Quality" }, { text: "Well Inspection Report", value: "Well Inspection" }, -] +].sort((a,b) => a.text.toLowerCase().localeCompare(b.text.toLowerCase())) export const WELL_TAGS = [ { diff --git a/app/frontend/src/wells/components/mixins/filters.js b/app/frontend/src/wells/components/mixins/filters.js index c806a8bf8..8132f1fb4 100644 --- a/app/frontend/src/wells/components/mixins/filters.js +++ b/app/frontend/src/wells/components/mixins/filters.js @@ -28,7 +28,11 @@ const SEARCH_FIELDS = { param: "well_document_type", label: "Contains document type", type: "select", - options: [...WELL_TAGS_PUBLIC, ...WELL_TAGS_PRIVATE].sort((a,b) => a.text.toLowerCase()-b.text.toLowerCase()) + options: [...WELL_TAGS_PUBLIC, ...WELL_TAGS_PRIVATE].sort((a,b) => { + if(a.text === 'Other') return 1; + if(b.text === 'Other') return -1; + return a.text.toLowerCase().localeCompare(b.text.toLowerCase()) + }) }, streetOrCity: { param: 'street_address_or_city',