From a6c73ccf06f81d7bdb0f7930cb874a2fb2200b87 Mon Sep 17 00:00:00 2001 From: Tatiana Villa Date: Sat, 21 Feb 2026 17:43:55 +0100 Subject: [PATCH] cambiando url de apis --- eltiempo/js/estadisticas.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/eltiempo/js/estadisticas.js b/eltiempo/js/estadisticas.js index 5d29cc9..439bc64 100644 --- a/eltiempo/js/estadisticas.js +++ b/eltiempo/js/estadisticas.js @@ -50,17 +50,18 @@ function updateMonthHeader() { // ==================== async function loadStats(options = {}) { try { - const url = buildApiUrl({ - ciudad: ciudadActual, - ...options - }); + const url = buildApiUrl({ ciudad: ciudadActual, ...options }); const response = await fetch(url); if (!response.ok) throw new Error("Error cargando datos: " + response.status); - const data = await response.json(); + let data = await response.json(); // Cambia 'const' por 'let' if (!data || !data.length) throw new Error("Datos vacĂ­os"); + // --- FILTRADO POR CIUDAD (Importante mientras Java no filtre) --- + data = data.filter(d => d.ciudad === ciudadActual); + // ---------------------------------------------------------------- + renderLastData(data); renderMonthStats(data); renderTrend(data);