Fix Categorias y Captura de Bancas
This commit is contained in:
@@ -498,7 +498,7 @@ public class ResultadosController : ControllerBase
|
||||
todasAgrupaciones.TryGetValue(idPartidoPresidenteSenadores ?? "", out var presidenteSenadores);
|
||||
|
||||
string? idPartidoPresidenteDiputados = bancasPorAgrupacion
|
||||
.Where(b => b.CategoriaId == 6)
|
||||
.Where(b => b.CategoriaId == 3)
|
||||
.OrderByDescending(b => b.BancasTotales)
|
||||
.FirstOrDefault()?.AgrupacionId;
|
||||
todasAgrupaciones.TryGetValue(idPartidoPresidenteDiputados ?? "", out var presidenteDiputados);
|
||||
@@ -509,7 +509,7 @@ public class ResultadosController : ControllerBase
|
||||
.Where(b => b.CategoriaId == categoriaId && b.BancasTotales > 0)
|
||||
.Select(b => new { Bancas = b, Agrupacion = todasAgrupaciones[b.AgrupacionId] });
|
||||
|
||||
if (categoriaId == 6) // Diputados
|
||||
if (categoriaId == 3) // Diputados
|
||||
partidosDeCamara = partidosDeCamara.OrderBy(b => b.Agrupacion.OrdenDiputados ?? 999)
|
||||
.ThenByDescending(b => b.Bancas.BancasTotales);
|
||||
else // Senadores
|
||||
@@ -825,8 +825,8 @@ public class ResultadosController : ControllerBase
|
||||
s.Nombre,
|
||||
// Convertimos la lista de IDs de cargo a una lista de strings ("diputados", "senadores")
|
||||
CamarasDisponibles = s.Cargos.Select(CategoriaId =>
|
||||
CategoriaId == 6 ? "diputados" : // Asume 5 = Diputados
|
||||
CategoriaId == 5 ? "senadores" : // Asume 6 = Senadores
|
||||
CategoriaId == 3 ? "diputados" : // Asume 3 = Diputados
|
||||
CategoriaId == 2 ? "senadores" : // Asume 2 = Senadores
|
||||
null
|
||||
).Where(c => c != null).ToList()
|
||||
});
|
||||
@@ -1348,9 +1348,9 @@ public class ResultadosController : ControllerBase
|
||||
{
|
||||
Agrupacion = agrupacion,
|
||||
DiputadosFijos = bancasPrevias.FirstOrDefault(b => b.AgrupacionPoliticaId == agrupacion.Id && b.Camara == Core.Enums.TipoCamara.Diputados)?.Cantidad ?? 0,
|
||||
DiputadosGanados = proyecciones.Where(p => p.AgrupacionPoliticaId == agrupacion.Id && p.CategoriaId == 2).Sum(p => p.NroBancas),
|
||||
DiputadosGanados = proyecciones.Where(p => p.AgrupacionPoliticaId == agrupacion.Id && p.CategoriaId == 3).Sum(p => p.NroBancas),
|
||||
SenadoresFijos = bancasPrevias.FirstOrDefault(b => b.AgrupacionPoliticaId == agrupacion.Id && b.Camara == Core.Enums.TipoCamara.Senadores)?.Cantidad ?? 0,
|
||||
SenadoresGanados = proyecciones.Where(p => p.AgrupacionPoliticaId == agrupacion.Id && p.CategoriaId == 1).Sum(p => p.NroBancas)
|
||||
SenadoresGanados = proyecciones.Where(p => p.AgrupacionPoliticaId == agrupacion.Id && p.CategoriaId == 2).Sum(p => p.NroBancas)
|
||||
})
|
||||
.Select(r => new
|
||||
{
|
||||
@@ -1464,8 +1464,8 @@ List<CandidatoOverride> overrides, string agrupacionId, int categoriaId, int? am
|
||||
{
|
||||
if (cantidadResultados < 1) cantidadResultados = 1;
|
||||
|
||||
const int catDiputadosNac = 2;
|
||||
const int catSenadoresNac = 1;
|
||||
const int catDiputadosNac = 3;
|
||||
const int catSenadoresNac = 2;
|
||||
|
||||
var provinciasQueRenuevanSenadores = new HashSet<string> { "01", "06", "08", "15", "16", "17", "22", "23" };
|
||||
var todasLasProyecciones = await _dbContext.ProyeccionesBancas.AsNoTracking().Where(p => p.EleccionId == eleccionId && (p.CategoriaId == catDiputadosNac || p.CategoriaId == catSenadoresNac)).ToDictionaryAsync(p => p.AmbitoGeograficoId + "_" + p.AgrupacionPoliticaId + "_" + p.CategoriaId);
|
||||
@@ -1575,7 +1575,7 @@ List<CandidatoOverride> overrides, string agrupacionId, int categoriaId, int? am
|
||||
var respuesta = new CategoriaResumenHomeDto
|
||||
{
|
||||
CategoriaId = categoriaId,
|
||||
CategoriaNombre = estado?.CategoriaElectoral.Nombre ?? (categoriaId == 2 ? "DIPUTADOS NACIONALES" : "SENADORES NACIONALES"),
|
||||
CategoriaNombre = estado?.CategoriaElectoral.Nombre ?? (categoriaId == 3 ? "DIPUTADOS NACIONALES" : "SENADORES NACIONALES"),
|
||||
UltimaActualizacion = estado?.FechaTotalizacion ?? DateTime.UtcNow,
|
||||
EstadoRecuento = estado != null ? new EstadoRecuentoDto
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ public class CriticalDataWorker : BackgroundService
|
||||
{
|
||||
_logger.LogInformation("Ejecutando tareas de Baja Prioridad en alta prioridad.");
|
||||
await SondearProyeccionBancasAsync(authToken, stoppingToken);
|
||||
await SondearNuevosTelegramasAsync(authToken, stoppingToken);
|
||||
//await SondearNuevosTelegramasAsync(authToken, stoppingToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ public class LowPriorityDataWorker : BackgroundService
|
||||
{
|
||||
_logger.LogInformation("Ejecutando tareas de Baja Prioridad en baja prioridad.");
|
||||
await SondearProyeccionBancasAsync(authToken, stoppingToken);
|
||||
await SondearNuevosTelegramasAsync(authToken, stoppingToken);
|
||||
//await SondearNuevosTelegramasAsync(authToken, stoppingToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user