Fix CABA y Nombres Comunas
This commit is contained in:
		| @@ -30,7 +30,7 @@ interface ViewConfig { | |||||||
| const PROVINCE_VIEW_CONFIG: Record<string, { desktop: ViewConfig; mobile?: ViewConfig }> = { | const PROVINCE_VIEW_CONFIG: Record<string, { desktop: ViewConfig; mobile?: ViewConfig }> = { | ||||||
|   "BUENOS AIRES": { desktop: { center: [-60.5, -37.3], zoom: 5 }, mobile: { center: [-60, -38], zoom: 5.5 } }, |   "BUENOS AIRES": { desktop: { center: [-60.5, -37.3], zoom: 5 }, mobile: { center: [-60, -38], zoom: 5.5 } }, | ||||||
|   "SANTA CRUZ": { desktop: { center: [-69.5, -49.3], zoom: 5 }, mobile: { center: [-69.5, -50], zoom: 4 } }, |   "SANTA CRUZ": { desktop: { center: [-69.5, -49.3], zoom: 5 }, mobile: { center: [-69.5, -50], zoom: 4 } }, | ||||||
|   "CIUDAD AUTONOMA DE BUENOS AIRES": { desktop: { center: [-58.44, -34.65], zoom: 150 } }, |   "CAPITAL FEDERAL": { desktop: { center: [-58.44, -34.65], zoom: 150 } }, | ||||||
|   "CHUBUT": { desktop: { center: [-68.5, -44.5], zoom: 5.5 }, mobile: { center: [-68, -44.5], zoom: 4.5 } }, |   "CHUBUT": { desktop: { center: [-68.5, -44.5], zoom: 5.5 }, mobile: { center: [-68, -44.5], zoom: 4.5 } }, | ||||||
|   "SANTA FE": { desktop: { center: [-61, -31.2], zoom: 6 }, mobile: { center: [-61, -31.5], zoom: 7.5 } }, |   "SANTA FE": { desktop: { center: [-61, -31.2], zoom: 6 }, mobile: { center: [-61, -31.5], zoom: 7.5 } }, | ||||||
|   "CORRIENTES": { desktop: { center: [-58, -29], zoom: 7 }, mobile: { center: [-57.5, -28.8], zoom: 9 } }, |   "CORRIENTES": { desktop: { center: [-58, -29], zoom: 7 }, mobile: { center: [-57.5, -28.8], zoom: 9 } }, | ||||||
|   | |||||||
| @@ -7,9 +7,6 @@ import { geoCentroid } from 'd3-geo'; | |||||||
| import { feature } from 'topojson-client'; | import { feature } from 'topojson-client'; | ||||||
| import { API_BASE_URL, assetBaseUrl } from '../../../../apiService'; | import { API_BASE_URL, assetBaseUrl } from '../../../../apiService'; | ||||||
| import type { ResultadoMapaDto, AmbitoGeography } from '../../../../types/types'; | import type { ResultadoMapaDto, AmbitoGeography } from '../../../../types/types'; | ||||||
| // 1. A diferencia de otros componentes, este no necesita importar el CSS |  | ||||||
| // porque no tiene un contenedor propio ni clases únicas. |  | ||||||
| // Heredará y usará las clases globales (:global) definidas en PanelNacional.module.css |  | ||||||
|  |  | ||||||
| const DEFAULT_MAP_COLOR = '#E0E0E0'; | const DEFAULT_MAP_COLOR = '#E0E0E0'; | ||||||
| const normalizarTexto = (texto: string = ''): string => texto.trim().toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); | const normalizarTexto = (texto: string = ''): string => texto.trim().toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); | ||||||
| @@ -66,9 +63,6 @@ export const MapaProvincial = ({ eleccionId, categoriaId, distritoId, nombreProv | |||||||
|         const resultado = resultadosPorNombre.get(normalizarTexto(geo.properties.departamento)); |         const resultado = resultadosPorNombre.get(normalizarTexto(geo.properties.departamento)); | ||||||
|         const esSeleccionado = nombreMunicipioSeleccionado ? normalizarTexto(geo.properties.departamento) === normalizarTexto(nombreMunicipioSeleccionado) : false; |         const esSeleccionado = nombreMunicipioSeleccionado ? normalizarTexto(geo.properties.departamento) === normalizarTexto(nombreMunicipioSeleccionado) : false; | ||||||
|  |  | ||||||
|         // 2. Las clases aquí NO usan el objeto 'styles' porque son clases |  | ||||||
|         // que react-simple-maps necesita globalmente. El archivo CSS |  | ||||||
|         // ya se encarga de estilizarlas usando :global(.rsm-geography), etc. |  | ||||||
|         const classNames = [ |         const classNames = [ | ||||||
|           'rsm-geography', |           'rsm-geography', | ||||||
|           'mapa-provincial-geography', |           'mapa-provincial-geography', | ||||||
|   | |||||||
| @@ -495,9 +495,24 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|  |  | ||||||
|             if (!ambitosEnDb.ContainsKey(claveUnica)) |             if (!ambitosEnDb.ContainsKey(claveUnica)) | ||||||
|             { |             { | ||||||
|  |               string nombreCorregido = ambitoDto.Nombre; | ||||||
|  |  | ||||||
|  |               // VERIFICAMOS SI ES UNA COMUNA DE CABA | ||||||
|  |               // Condición: El DistritoId es "01" (CABA) Y el NivelId corresponde a Departamento/Comuna (30) | ||||||
|  |               // Y el nombre es simplemente un número. | ||||||
|  |               if (ambitoDto.CodigoAmbitos.DistritoId == "01" && | ||||||
|  |                   ambitoDto.NivelId == 30 && | ||||||
|  |                   int.TryParse(ambitoDto.Nombre, out int numeroComuna)) | ||||||
|  |               { | ||||||
|  |                 // Si cumple las condiciones, le damos el formato correcto. | ||||||
|  |                 nombreCorregido = $"COMUNA {numeroComuna}"; | ||||||
|  |                 _logger.LogInformation("Nombre de comuna de CABA corregido: de '{Original}' a '{Corregido}'", ambitoDto.Nombre, nombreCorregido); | ||||||
|  |               } | ||||||
|  |  | ||||||
|               var nuevoAmbito = new AmbitoGeografico |               var nuevoAmbito = new AmbitoGeografico | ||||||
|               { |               { | ||||||
|                 Nombre = ambitoDto.Nombre, |                 // Usamos el nombre corregido en lugar del original. | ||||||
|  |                 Nombre = nombreCorregido, | ||||||
|                 NivelId = ambitoDto.NivelId, |                 NivelId = ambitoDto.NivelId, | ||||||
|                 DistritoId = ambitoDto.CodigoAmbitos.DistritoId, |                 DistritoId = ambitoDto.CodigoAmbitos.DistritoId, | ||||||
|                 SeccionProvincialId = ambitoDto.CodigoAmbitos.SeccionProvincialId, |                 SeccionProvincialId = ambitoDto.CodigoAmbitos.SeccionProvincialId, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user