chore(tides): remove debug console.logs from backend
This commit is contained in:
@@ -243,7 +243,6 @@ async function doGeocode(q: string): Promise<GeocodingResult | null> {
|
|||||||
url.searchParams.set('count', '10')
|
url.searchParams.set('count', '10')
|
||||||
url.searchParams.set('language', 'de')
|
url.searchParams.set('language', 'de')
|
||||||
|
|
||||||
console.log(`[geocodePlace] Fetching URL: ${url.toString()}`);
|
|
||||||
try {
|
try {
|
||||||
const data = await fetchJson<{ results?: GeocodingResult[] }>(url.toString())
|
const data = await fetchJson<{ results?: GeocodingResult[] }>(url.toString())
|
||||||
const results = data.results ?? []
|
const results = data.results ?? []
|
||||||
@@ -259,23 +258,14 @@ async function doGeocode(q: string): Promise<GeocodingResult | null> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function geocodePlace(query: string): Promise<GeocodingResult | null> {
|
export async function geocodePlace(query: string): Promise<GeocodingResult | null> {
|
||||||
console.log(`[geocodePlace] query: "${query}" (length: ${query.length})`);
|
|
||||||
|
|
||||||
let match = await doGeocode(query)
|
let match = await doGeocode(query)
|
||||||
if (!match) {
|
if (!match) {
|
||||||
const fallbackQuery = replaceGermanDigraphs(query)
|
const fallbackQuery = replaceGermanDigraphs(query)
|
||||||
if (fallbackQuery !== query) {
|
if (fallbackQuery !== query) {
|
||||||
console.log(`[geocodePlace] No results for "${query}". Trying fallback query: "${fallbackQuery}"`);
|
|
||||||
match = await doGeocode(fallbackQuery)
|
match = await doGeocode(fallbackQuery)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
|
||||||
console.log(`[geocodePlace] Best match for "${query}": ${match.name} (${match.latitude}, ${match.longitude})`);
|
|
||||||
} else {
|
|
||||||
console.log(`[geocodePlace] No results found for "${query}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return match
|
return match
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ export async function fetchTidesForPlace(query: string): Promise<TideProviderRes
|
|||||||
match = stations.find(s => normalizeForMatching(s.name).startsWith(normQuery))
|
match = stations.find(s => normalizeForMatching(s.name).startsWith(normQuery))
|
||||||
}
|
}
|
||||||
if (match) {
|
if (match) {
|
||||||
console.log(`[tideProvider] Match found in BSH station index for "${query}": ${match.name} (${match.id})`)
|
|
||||||
return await fetchTidesForStation(match.id)
|
return await fetchTidesForStation(match.id)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -116,7 +115,6 @@ export async function fetchTidesForPlace(query: string): Promise<TideProviderRes
|
|||||||
normQuery.includes(normalizeForMatching(s.name))
|
normQuery.includes(normalizeForMatching(s.name))
|
||||||
)
|
)
|
||||||
if (match) {
|
if (match) {
|
||||||
console.log(`[tideProvider] Geocoding failed. Found fallback BSH station match for "${query}": ${match.name} (${match.id})`)
|
|
||||||
return await fetchTidesForStation(match.id)
|
return await fetchTidesForStation(match.id)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user