Fix 1 Test 1534
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| Before Width: | Height: | Size: 821 B After Width: | Height: | Size: 821 B | 
| @@ -277,7 +277,7 @@ export const MapaNacional = ({ eleccionId, categoriaId, nivel, nombreAmbito, nom | |||||||
|             <Geographies geography={geoDataNacional}> |             <Geographies geography={geoDataNacional}> | ||||||
|               {({ geographies }: { geographies: AmbitoGeography[] }) => geographies.map((geo) => { |               {({ geographies }: { geographies: AmbitoGeography[] }) => geographies.map((geo) => { | ||||||
|                 const nombreNormalizado = normalizarTexto(geo.properties.nombre); |                 const nombreNormalizado = normalizarTexto(geo.properties.nombre); | ||||||
|                 const esCABA = nombreNormalizado === 'CIUDAD AUTONOMA DE BUENOS AIRES'; |                 const esCABA = nombreNormalizado === 'CAPITAL FEDERAL'; | ||||||
|                 const resultado = resultadosNacionalesPorNombre.get(nombreNormalizado); |                 const resultado = resultadosNacionalesPorNombre.get(nombreNormalizado); | ||||||
|                 const esProvinciaActiva = provinciaDistritoId && resultado?.ambitoId === provinciaDistritoId; |                 const esProvinciaActiva = provinciaDistritoId && resultado?.ambitoId === provinciaDistritoId; | ||||||
|  |  | ||||||
| @@ -320,7 +320,7 @@ export const MapaNacional = ({ eleccionId, categoriaId, nivel, nombreAmbito, nom | |||||||
|       {nivel === 'pais' && ( |       {nivel === 'pais' && ( | ||||||
|         <div id="caba-lupa-anchor" className={styles.cabaMagnifierContainer} style={lupaStyle} ref={lupaRef}> |         <div id="caba-lupa-anchor" className={styles.cabaMagnifierContainer} style={lupaStyle} ref={lupaRef}> | ||||||
|           {(() => { |           {(() => { | ||||||
|             const resultadoCABA = resultadosNacionalesPorNombre.get("CIUDAD AUTONOMA DE BUENOS AIRES"); |             const resultadoCABA = resultadosNacionalesPorNombre.get("CAPITAL FEDERAL"); | ||||||
|             const fillColor = resultadoCABA?.colorGanador || DEFAULT_MAP_COLOR; |             const fillColor = resultadoCABA?.colorGanador || DEFAULT_MAP_COLOR; | ||||||
|             const handleClick = () => { |             const handleClick = () => { | ||||||
|               if (resultadoCABA) { |               if (resultadoCABA) { | ||||||
|   | |||||||
| @@ -58,7 +58,7 @@ export const MapaProvincial = ({ eleccionId, categoriaId, distritoId, nombreProv | |||||||
|   }, [nivel, nombreMunicipioSeleccionado, geoData, onCalculatedCenter]); |   }, [nivel, nombreMunicipioSeleccionado, geoData, onCalculatedCenter]); | ||||||
|  |  | ||||||
|   const resultadosPorNombre = new Map<string, ResultadoMapaDto>(mapaData.map(d => [normalizarTexto(d.ambitoNombre), d])); |   const resultadosPorNombre = new Map<string, ResultadoMapaDto>(mapaData.map(d => [normalizarTexto(d.ambitoNombre), d])); | ||||||
|   const esCABA = normalizarTexto(nombreProvincia) === "CIUDAD AUTONOMA DE BUENOS AIRES"; |   const esCABA = normalizarTexto(nombreProvincia) === "CAPITAL FEDERAL"; | ||||||
|  |  | ||||||
|   return ( |   return ( | ||||||
|     <Geographies geography={geoData}> |     <Geographies geography={geoData}> | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ using System.Reflection; | |||||||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Api")] | [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Api")] | ||||||
| [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||||||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||||||
| [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+316f49f25b8be2bcfed57bcab8c5228843045a43")] | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+705a6f0f5e555e94c5a59348c2610c4a61cb53d3")] | ||||||
| [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Api")] | [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Api")] | ||||||
| [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Api")] | [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Api")] | ||||||
| [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ using System.Reflection; | |||||||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Core")] | [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Core")] | ||||||
| [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||||||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||||||
| [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+316f49f25b8be2bcfed57bcab8c5228843045a43")] | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+705a6f0f5e555e94c5a59348c2610c4a61cb53d3")] | ||||||
| [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Core")] | [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Core")] | ||||||
| [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Core")] | [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Core")] | ||||||
| [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ using System.Reflection; | |||||||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Database")] | [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Database")] | ||||||
| [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||||||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||||||
| [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+316f49f25b8be2bcfed57bcab8c5228843045a43")] | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+705a6f0f5e555e94c5a59348c2610c4a61cb53d3")] | ||||||
| [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Database")] | [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Database")] | ||||||
| [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Database")] | [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Database")] | ||||||
| [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ using System.Reflection; | |||||||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Infrastructure")] | [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Infrastructure")] | ||||||
| [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||||||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||||||
| [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+316f49f25b8be2bcfed57bcab8c5228843045a43")] | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+705a6f0f5e555e94c5a59348c2610c4a61cb53d3")] | ||||||
| [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Infrastructure")] | [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Infrastructure")] | ||||||
| [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Infrastructure")] | [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Infrastructure")] | ||||||
| [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||||||
|   | |||||||
| @@ -445,6 +445,27 @@ public class CriticalDataWorker : BackgroundService | |||||||
|  |  | ||||||
|     foreach (var votoPositivoDto in resultadosDto.ValoresTotalizadosPositivos) |     foreach (var votoPositivoDto in resultadosDto.ValoresTotalizadosPositivos) | ||||||
|     { |     { | ||||||
|  |       // PASO 1: VERIFICAR SI LA AGRUPACIÓN YA EXISTE EN NUESTRA BD | ||||||
|  |       var agrupacion = await dbContext.AgrupacionesPoliticas.FindAsync(votoPositivoDto.IdAgrupacion); | ||||||
|  |  | ||||||
|  |       // PASO 2: SI NO EXISTE, LA CREAMOS "SOBRE LA MARCHA" | ||||||
|  |       if (agrupacion == null) | ||||||
|  |       { | ||||||
|  |         _logger.LogWarning("Agrupación con ID {AgrupacionId} ('{Nombre}') no encontrada en el catálogo local. Creándola desde los datos de resultados.", | ||||||
|  |             votoPositivoDto.IdAgrupacion, votoPositivoDto.NombreAgrupacion); | ||||||
|  |  | ||||||
|  |         agrupacion = new AgrupacionPolitica | ||||||
|  |         { | ||||||
|  |           Id = votoPositivoDto.IdAgrupacion, | ||||||
|  |           Nombre = votoPositivoDto.NombreAgrupacion, | ||||||
|  |           // El IdTelegrama puede ser nulo, usamos el operador '??' para asignar un string vacío si es así. | ||||||
|  |           IdTelegrama = votoPositivoDto.IdAgrupacionTelegrama ?? string.Empty | ||||||
|  |         }; | ||||||
|  |         await dbContext.AgrupacionesPoliticas.AddAsync(agrupacion, stoppingToken); | ||||||
|  |         // No es necesario llamar a SaveChangesAsync aquí, se hará al final. | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       // PASO 3: CONTINUAR CON LA LÓGICA DE GUARDADO DEL VOTO | ||||||
|       var resultadoVoto = await dbContext.ResultadosVotos.FirstOrDefaultAsync( |       var resultadoVoto = await dbContext.ResultadosVotos.FirstOrDefaultAsync( | ||||||
|           rv => rv.AmbitoGeograficoId == ambitoId && |           rv => rv.AmbitoGeograficoId == ambitoId && | ||||||
|                 rv.CategoriaId == categoriaId && |                 rv.CategoriaId == categoriaId && | ||||||
|   | |||||||
| @@ -167,6 +167,27 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|  |  | ||||||
|     foreach (var votoPositivoDto in resultadosDto.ValoresTotalizadosPositivos) |     foreach (var votoPositivoDto in resultadosDto.ValoresTotalizadosPositivos) | ||||||
|     { |     { | ||||||
|  |       // PASO 1: VERIFICAR SI LA AGRUPACIÓN YA EXISTE EN NUESTRA BD | ||||||
|  |       var agrupacion = await dbContext.AgrupacionesPoliticas.FindAsync(votoPositivoDto.IdAgrupacion); | ||||||
|  |  | ||||||
|  |       // PASO 2: SI NO EXISTE, LA CREAMOS "SOBRE LA MARCHA" | ||||||
|  |       if (agrupacion == null) | ||||||
|  |       { | ||||||
|  |         _logger.LogWarning("Agrupación con ID {AgrupacionId} ('{Nombre}') no encontrada en el catálogo local. Creándola desde los datos de resultados.", | ||||||
|  |             votoPositivoDto.IdAgrupacion, votoPositivoDto.NombreAgrupacion); | ||||||
|  |  | ||||||
|  |         agrupacion = new AgrupacionPolitica | ||||||
|  |         { | ||||||
|  |           Id = votoPositivoDto.IdAgrupacion, | ||||||
|  |           Nombre = votoPositivoDto.NombreAgrupacion, | ||||||
|  |           // El IdTelegrama puede ser nulo, usamos el operador '??' para asignar un string vacío si es así. | ||||||
|  |           IdTelegrama = votoPositivoDto.IdAgrupacionTelegrama ?? string.Empty | ||||||
|  |         }; | ||||||
|  |         await dbContext.AgrupacionesPoliticas.AddAsync(agrupacion, stoppingToken); | ||||||
|  |         // No es necesario llamar a SaveChangesAsync aquí, se hará al final. | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       // PASO 3: CONTINUAR CON LA LÓGICA DE GUARDADO DEL VOTO | ||||||
|       var resultadoVoto = await dbContext.ResultadosVotos.FirstOrDefaultAsync( |       var resultadoVoto = await dbContext.ResultadosVotos.FirstOrDefaultAsync( | ||||||
|           rv => rv.AmbitoGeograficoId == ambitoId && |           rv => rv.AmbitoGeograficoId == ambitoId && | ||||||
|                 rv.CategoriaId == categoriaId && |                 rv.CategoriaId == categoriaId && | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|     }, |     }, | ||||||
|   "ElectoralApi": { |   "ElectoralApi": { | ||||||
|     "BaseUrl": "https://api.resultados.gob.ar", |     "BaseUrl": "https://api.resultados.gob.ar", | ||||||
|     "Username": "30500094156@elecciones2025.onmicrosoft.com", |     "Username": "27238291726@elecciones2025.onmicrosoft.com", | ||||||
|     "Password": "PTP847elec" |     "Password": "PTP847elec" | ||||||
|   }, |   }, | ||||||
|   "ConnectionStrings": { |   "ConnectionStrings": { | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ using System.Reflection; | |||||||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Worker")] | [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Worker")] | ||||||
| [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||||||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||||||
| [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+84f764390766e1d9716a38464ee478f3d0b75f96")] | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+705a6f0f5e555e94c5a59348c2610c4a61cb53d3")] | ||||||
| [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Worker")] | [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Worker")] | ||||||
| [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Worker")] | [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Worker")] | ||||||
| [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user