From 0b69f1b5c12295653f52eada25580d4b2ef2f58e Mon Sep 17 00:00:00 2001 From: Nulo Date: Mon, 16 Dec 2024 23:52:14 -0300 Subject: [PATCH] perf: dejar de calcular cosas que no usamos --- .../src/routes/id_producto/[id]/+page.svelte | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/sepa/sitio2/src/routes/id_producto/[id]/+page.svelte b/sepa/sitio2/src/routes/id_producto/[id]/+page.svelte index e270576..6dbe889 100644 --- a/sepa/sitio2/src/routes/id_producto/[id]/+page.svelte +++ b/sepa/sitio2/src/routes/id_producto/[id]/+page.svelte @@ -30,20 +30,18 @@ const query = $page.url.searchParams.get('query'); function generateGeoJSON(precios: (typeof data)['precios']): GeoJSONType { - const prices = data.precios.map((p) => p.productos_precio_lista); - const sortedPrices = prices.sort((a, b) => a - b); - const q1Index = Math.floor(sortedPrices.length * 0.1); - const q3Index = Math.floor(sortedPrices.length * 0.9); - const iqr = sortedPrices[q3Index] - sortedPrices[q1Index]; - const lowerBound = sortedPrices[q1Index] - 1.5 * iqr; - const upperBound = sortedPrices[q3Index] + 1.5 * iqr; - const filteredPrices = sortedPrices.filter((p) => p >= lowerBound && p <= upperBound); - const min = Math.min(...filteredPrices); - const max = Math.max(...filteredPrices); + // const prices = precios.map((p) => p.productos_precio_lista); + // const sortedPrices = prices.sort((a, b) => a - b); + // const q1Index = Math.floor(sortedPrices.length * 0.1); + // const q3Index = Math.floor(sortedPrices.length * 0.9); + // const iqr = sortedPrices[q3Index] - sortedPrices[q1Index]; + // const lowerBound = sortedPrices[q1Index] - 1.5 * iqr; + // const upperBound = sortedPrices[q3Index] + 1.5 * iqr; + // const filteredPrices = sortedPrices.filter((p) => p >= lowerBound && p <= upperBound); return { type: 'FeatureCollection', - features: data.precios.map((precio) => ({ + features: precios.map((precio) => ({ type: 'Feature', geometry: { type: 'Point',