-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Right now it's using mock data, so only need to launch the front project (en sure docker desktop is installed, up and running)
clone the project.
Execute
npm installExecute
npm startThen take a look to the following pod:
front/src/pods/embalse-search
I would add there a file called
front/src/pods/embalse-search/embalse-search.business.ts
And there include a function with the following signature
//This function replaces accented vowels with unaccented vowels in a text string and place everything lowercase
// Rember to add unit tests here :)
export const normalizeSearchString= (input : string) :string => {
// Do your thing
// Convert to lower
// Replace accented vowels
}And in this method:
const getFilteredEmbalses = (inputValue: string): EmbalseSearchModel[] => {
- const lower = inputValue.toLowerCase();
+ const normalizedInputValue = normalizeSearchString(intpuValue);
return embalses
.filter(
(e) =>
- e.name.toLowerCase().includes(lower) ||
- e.province.toLowerCase().includes(lower),
+ normalizeSearchString(e.name).includes(normalizedInputValue.) ||
+ normalizeSearchString(e.province).includes(normalizedInputValue),
)
.map(mapEmbalseToSearch);
};Reactions are currently unavailable