From b8418d518dad709cba338736721013b6db8aa925 Mon Sep 17 00:00:00 2001 From: Yelena Cox Date: Mon, 11 Nov 2024 14:11:12 -0600 Subject: [PATCH 1/2] FD-1680 -- Preferred Terminology Filtering by Name and System --- .../Projects/Terminologies/PreferredTerminology.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/Projects/Terminologies/PreferredTerminology.jsx b/src/components/Projects/Terminologies/PreferredTerminology.jsx index dacf0f5..ef66b10 100644 --- a/src/components/Projects/Terminologies/PreferredTerminology.jsx +++ b/src/components/Projects/Terminologies/PreferredTerminology.jsx @@ -144,14 +144,17 @@ export const PreferredTerminology = ({ terminology, setTerminology }) => { setPreferredData([]); }; - // Filters the terminologies that have already been selected out of the main terminology array to avoid duplicates + // Filters terminologies that have already been selected (by combination of name and url) out of the main terminology array to avoid duplicates const filterTerminologies = () => { const terminologiesToExclude = new Set([ - ...prefTerminologies?.map(pt => pt?.id), - ...displaySelectedTerminologies?.map(dst => dst?.id), - ...preferredData?.map(ep => ep?.id), + ...prefTerminologies?.map(pt => `${pt?.name}|${pt?.url}`), + ...displaySelectedTerminologies?.map(dst => `${dst?.name}|${dst?.url}`), + ...preferredData?.map(ep => `${ep?.name}|${ep?.url}`), ]); - return terminologies.filter(t => !terminologiesToExclude?.has(t.id)); + + return terminologies.filter( + t => !terminologiesToExclude.has(`${t?.name}|${t?.url}`) + ); }; const filteredTerminologyArray = filterTerminologies(); From 85997e9b33347d55c3105814535c871a659b5a90 Mon Sep 17 00:00:00 2001 From: Yelena Cox Date: Mon, 11 Nov 2024 15:32:30 -0600 Subject: [PATCH 2/2] Bug not recognizing spaces in enumerated dropdown on var edit --- .../Projects/Tables/EditDataTypeSubForm.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/Projects/Tables/EditDataTypeSubForm.jsx b/src/components/Projects/Tables/EditDataTypeSubForm.jsx index 19f91e6..fd47948 100644 --- a/src/components/Projects/Tables/EditDataTypeSubForm.jsx +++ b/src/components/Projects/Tables/EditDataTypeSubForm.jsx @@ -57,13 +57,16 @@ function EditDataTypeSubForm({ type, form, editRow, tableData }) { }} placeholder="Search to Select" optionFilterProp="children" - filterOption={(input, option) => - (option?.label ?? '').includes(input) - } + // Searches by terminology name, accounting for spaces in the name + filterOption={(input, option) => { + const trimmedInput = input.toLowerCase().trim(); + const optionLabel = (option?.label).toLowerCase().trim(); + return optionLabel.includes(trimmedInput); + }} filterSort={(optionA, optionB) => - (optionA?.label ?? '') + (optionA?.label) .toLowerCase() - .localeCompare((optionB?.label ?? '').toLowerCase()) + .localeCompare((optionB?.label).toLowerCase()) } options={terminologies.map(term => { return {