Fix locaion override

This commit is contained in:
Gus Ruben 2025-07-31 15:29:53 -04:00
parent a8779921f8
commit 4b31281c6d

View file

@ -29,12 +29,13 @@ export async function load() {
// Geocode each event location
const locations = [];
for (const event of events) {
const { location, state, country, event_name, location_override } = event.fields;
const { location, state, country, event_name, address_override } = event.fields;
if (!location || !event_name) continue;
// Use location_override if set, otherwise build address string
const address = location_override || [location, state, country].filter(Boolean).join(', ');
// Use address_override if set, otherwise build address string
const address = address_override || [location, state, country].filter(Boolean).join(', ');
console.log(`${event_name}: ${address}`)
try {
const geocodeUrl = `https://geocoder.hackclub.com/v1/geocode?address=${encodeURIComponent(address)}&key=${GEOCODER_API_KEY}`;