Skip to content

Commit 82f04d4

Browse files
committed
chore: refactor location filtering logic
1 parent ea9eaa3 commit 82f04d4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

store/store.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ export const useWebsiteStore = defineStore('websiteStore', () => {
7878
}
7979
}
8080

81+
// Exclude locations with names that contain any of the following strings
82+
const ignoreLocationsNames = [
83+
'paróquia', 'nossa senhora'
84+
]
85+
8186
const citiesDatabase: Record<string, string> = {
8287
'Muenchen': 'Munich',
8388
'Zuerich': 'Zurich',
@@ -107,7 +112,11 @@ export const useWebsiteStore = defineStore('websiteStore', () => {
107112
loadingLocations.value = false
108113
return
109114
}
110-
locations.value[cityName] = locations.value[cityName]?.concat(res.data) || res.data
115+
116+
const allLocations = locations.value[cityName]
117+
.filter(location => !location.photo)
118+
.filter(location => !ignoreLocationsNames.some(name => location.name.toLowerCase().includes(name)))
119+
locations.value[cityName] = locations.value[cityName]?.concat(allLocations) || allLocations
111120
locationsCount.value[cityName] = res.pagination.total_items
112121
if (!fetchedPages.value[cityName]) {
113122
fetchedPages.value[cityName] = { pages: new Set(), totalPages: res.pagination.total_pages }

0 commit comments

Comments
 (0)