Feats y Fixs Varios
This commit is contained in:
@@ -4,7 +4,7 @@ import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { getBancadas, getAgrupaciones, updateBancada, type UpdateBancadaData } from '../services/apiService';
|
||||
import type { Bancada, AgrupacionPolitica } from '../types';
|
||||
import { OcupantesModal } from './OcupantesModal';
|
||||
import './AgrupacionesManager.css'; // Asegúrate de que este CSS tenga los estilos de .chamber-tabs
|
||||
import './AgrupacionesManager.css';
|
||||
|
||||
const camaras = ['diputados', 'senadores'] as const;
|
||||
|
||||
@@ -14,13 +14,11 @@ export const BancasManager = () => {
|
||||
const [bancadaSeleccionada, setBancadaSeleccionada] = useState<Bancada | null>(null);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
// Obtenemos todas las agrupaciones para poblar el <select>
|
||||
const { data: agrupaciones = [] } = useQuery<AgrupacionPolitica[]>({
|
||||
queryKey: ['agrupaciones'],
|
||||
queryFn: getAgrupaciones
|
||||
});
|
||||
|
||||
// Obtenemos las bancas para la cámara activa (diputados o senadores)
|
||||
const { data: bancadas = [], isLoading, error } = useQuery<Bancada[]>({
|
||||
queryKey: ['bancadas', activeTab],
|
||||
queryFn: () => getBancadas(activeTab),
|
||||
@@ -40,10 +38,9 @@ export const BancasManager = () => {
|
||||
|
||||
try {
|
||||
await updateBancada(bancadaId, payload);
|
||||
// Invalida la query para forzar una recarga de datos frescos desde el servidor
|
||||
queryClient.invalidateQueries({ queryKey: ['bancadas', activeTab] });
|
||||
} catch (err) {
|
||||
alert("Error al guardar el cambio.");
|
||||
alert("Error al guardar el cambio de agrupación.");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -57,7 +54,7 @@ export const BancasManager = () => {
|
||||
return (
|
||||
<div className="admin-module">
|
||||
<h2>Gestión de Ocupación de Bancas</h2>
|
||||
<p>Asigne a cada banca un partido político y, opcionalmente, los datos de la persona que la ocupa.</p>
|
||||
<p>Asigne a cada banca física un partido político y, opcionalmente, los datos de la persona que la ocupa.</p>
|
||||
|
||||
<div className="chamber-tabs">
|
||||
{camaras.map(camara => (
|
||||
@@ -75,16 +72,25 @@ export const BancasManager = () => {
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Banca #</th>
|
||||
<th>Partido Asignado</th>
|
||||
<th>Ocupante Actual</th>
|
||||
<th>Acciones</th>
|
||||
<th style={{ width: '15%' }}>Banca #</th>
|
||||
<th style={{ width: '35%' }}>Partido Asignado</th>
|
||||
<th style={{ width: '30%' }}>Ocupante Actual</th>
|
||||
<th style={{ width: '20%' }}>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{bancadas.map((bancada, index) => (
|
||||
{bancadas.map((bancada) => (
|
||||
<tr key={bancada.id}>
|
||||
<td>{`${activeTab.charAt(0).toUpperCase()}-${index + 1}`}</td>
|
||||
{/* Usamos el NumeroBanca para la etiqueta visual */}
|
||||
<td>
|
||||
{`${activeTab.charAt(0).toUpperCase()}-${bancada.numeroBanca}`}
|
||||
{((activeTab === 'diputados' && bancada.numeroBanca === 92) ||
|
||||
(activeTab === 'senadores' && bancada.numeroBanca === 46)) && (
|
||||
<span style={{ marginLeft: '8px', fontSize: '0.8em', color: '#666', fontStyle: 'italic' }}>
|
||||
(Presidencia)
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
<td>
|
||||
<select
|
||||
value={bancada.agrupacionPoliticaId || ''}
|
||||
@@ -97,6 +103,7 @@ export const BancasManager = () => {
|
||||
<td>{bancada.ocupante?.nombreOcupante || 'Sin asignar'}</td>
|
||||
<td>
|
||||
<button
|
||||
// El botón se habilita solo si hay un partido asignado a la banca
|
||||
disabled={!bancada.agrupacionPoliticaId}
|
||||
onClick={() => handleOpenModal(bancada)}
|
||||
>
|
||||
|
||||
@@ -16,9 +16,7 @@ export const DashboardPage = () => {
|
||||
<button onClick={logout}>Cerrar Sesión</button>
|
||||
</header>
|
||||
<main style={{ marginTop: '2rem' }}>
|
||||
<ConfiguracionGeneral />
|
||||
<AgrupacionesManager />
|
||||
|
||||
<div style={{ display: 'flex', gap: '2rem', flexWrap: 'wrap', marginTop: '2rem' }}>
|
||||
<div style={{ flex: '1 1 400px' }}>
|
||||
<OrdenDiputadosManager />
|
||||
@@ -27,6 +25,7 @@ export const DashboardPage = () => {
|
||||
<OrdenSenadoresManager />
|
||||
</div>
|
||||
</div>
|
||||
<ConfiguracionGeneral />
|
||||
<BancasManager />
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@@ -36,6 +36,7 @@ export interface OcupanteBanca {
|
||||
export interface Bancada {
|
||||
id: number;
|
||||
camara: TipoCamaraValue;
|
||||
numeroBanca: number;
|
||||
agrupacionPoliticaId: string | null;
|
||||
agrupacionPolitica: AgrupacionPolitica | null;
|
||||
ocupante: OcupanteBanca | null;
|
||||
|
||||
BIN
Elecciones-Web/frontend/public/default-avatar.png
Normal file
BIN
Elecciones-Web/frontend/public/default-avatar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -42,6 +42,7 @@ interface PartidoData {
|
||||
export interface BancadaDetalle {
|
||||
id: number; // Este es el ID de la Bancada
|
||||
camara: number; // 0 o 1
|
||||
numeroBanca: number;
|
||||
agrupacionPoliticaId: string | null;
|
||||
ocupante: OcupanteBanca | null;
|
||||
}
|
||||
|
||||
@@ -202,3 +202,8 @@
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#seat-tooltip.react-tooltip {
|
||||
opacity: 1 !important;
|
||||
background-color: white; /* Opcional: asegura un fondo sólido */
|
||||
}
|
||||
@@ -29,44 +29,44 @@ export const CongresoWidget = () => {
|
||||
|
||||
const datosCamaraActual = composicionData ? composicionData[camaraActiva] : null;
|
||||
|
||||
const esModoOficial = bancadasDetalle.length > 0;
|
||||
|
||||
// --- LÓGICA DE SEATFILLDATA ---
|
||||
const seatFillData = useMemo(() => {
|
||||
if (!datosCamaraActual) return [];
|
||||
|
||||
// --- LÓGICA DEL INTERRUPTOR ---
|
||||
// Verificamos si la respuesta de la API contiene datos de ocupantes.
|
||||
// Si bancadasDetalle tiene elementos, significa que el modo "Oficial" está activo en el backend.
|
||||
const modoOficialActivo = bancadasDetalle.length > 0;
|
||||
|
||||
if (modoOficialActivo) {
|
||||
// --- MODO OFICIAL: Construir desde las bancas físicas ---
|
||||
if (esModoOficial) {
|
||||
// --- MODO OFICIAL ---
|
||||
const camaraId = camaraActiva === 'diputados' ? 0 : 1;
|
||||
const bancadasDeCamara = bancadasDetalle.filter(b => b.camara === camaraId);
|
||||
|
||||
const colorMap = new Map<string, string>();
|
||||
datosCamaraActual.partidos.forEach(p => {
|
||||
if (p.id && p.color) {
|
||||
colorMap.set(p.id, p.color);
|
||||
datosCamaraActual.partidos.forEach(p => { if (p.id && p.color) colorMap.set(p.id, p.color); });
|
||||
|
||||
// 1. Creamos un array del tamaño correcto, lleno de 'null's
|
||||
const size = camaraActiva === 'diputados' ? 92 : 46;
|
||||
const finalSeatData = new Array(size).fill(null);
|
||||
|
||||
// 2. Poblamos el array usando NumeroBanca como índice
|
||||
bancadasDeCamara.forEach(bancada => {
|
||||
// El índice del SVG es NumeroBanca - 1
|
||||
const index = bancada.numeroBanca - 1;
|
||||
if (index >= 0 && index < size) {
|
||||
finalSeatData[index] = {
|
||||
color: bancada.agrupacionPoliticaId ? colorMap.get(bancada.agrupacionPoliticaId) || DEFAULT_COLOR : DEFAULT_COLOR,
|
||||
ocupante: bancada.ocupante
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
const bancadasOrdenadas = bancadasDeCamara.sort((a, b) => a.id - b.id);
|
||||
|
||||
return bancadasOrdenadas.map(bancada => ({
|
||||
color: bancada.agrupacionPoliticaId ? colorMap.get(bancada.agrupacionPoliticaId) || DEFAULT_COLOR : DEFAULT_COLOR,
|
||||
ocupante: bancada.ocupante
|
||||
}));
|
||||
return finalSeatData;
|
||||
|
||||
} else {
|
||||
// --- MODO PROYECCIÓN: Construir desde los totales de los partidos ---
|
||||
// Esta es la lógica original que teníamos para el modo proyección.
|
||||
// --- MODO PROYECCIÓN ---
|
||||
return datosCamaraActual.partidos.flatMap(party => {
|
||||
const seatColor = party.color || DEFAULT_COLOR;
|
||||
// En modo proyección, no hay ocupantes individuales.
|
||||
return Array(party.bancasTotales).fill({ color: seatColor, ocupante: null });
|
||||
});
|
||||
}
|
||||
|
||||
}, [datosCamaraActual, bancadasDetalle, camaraActiva]);
|
||||
|
||||
if (isLoadingComposicion) return <div className="congreso-container loading">Cargando...</div>;
|
||||
@@ -78,11 +78,23 @@ export const CongresoWidget = () => {
|
||||
<div className="congreso-container">
|
||||
<div className="congreso-grafico">
|
||||
{camaraActiva === 'diputados' ? (
|
||||
<ParliamentLayout seatData={seatFillData} presidenteBancada={datosCamaraActual.presidenteBancada} />
|
||||
<ParliamentLayout
|
||||
seatData={seatFillData}
|
||||
// --- INICIO DE LA CORRECCIÓN ---
|
||||
// Solo pasamos la prop 'presidenteBancada' si NO estamos en modo oficial
|
||||
presidenteBancada={!esModoOficial ? datosCamaraActual.presidenteBancada : undefined}
|
||||
// --- FIN DE LA CORRECCIÓN ---
|
||||
/>
|
||||
) : (
|
||||
<SenateLayout seatData={seatFillData} presidenteBancada={datosCamaraActual.presidenteBancada} />
|
||||
<SenateLayout
|
||||
seatData={seatFillData}
|
||||
// --- INICIO DE LA CORRECCIÓN ---
|
||||
presidenteBancada={!esModoOficial ? datosCamaraActual.presidenteBancada : undefined}
|
||||
// --- FIN DE LA CORRECCIÓN ---
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="congreso-summary">
|
||||
<div className="chamber-tabs">
|
||||
<button
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// src/components/ParliamentLayout.tsx
|
||||
import React from 'react';
|
||||
import React, { useLayoutEffect } from 'react';
|
||||
import { handleImageFallback } from './imageFallback';
|
||||
|
||||
// Interfaces (no cambian)
|
||||
interface SeatFillData {
|
||||
@@ -14,7 +15,7 @@ interface SeatFillData {
|
||||
interface ParliamentLayoutProps {
|
||||
seatData: SeatFillData[];
|
||||
size?: number;
|
||||
presidenteBancada: { color: string | null } | null;
|
||||
presidenteBancada?: { color: string | null } | null;
|
||||
}
|
||||
|
||||
const PRESIDENTE_SEAT_INDEX = 91;
|
||||
@@ -24,9 +25,14 @@ export const ParliamentLayout: React.FC<ParliamentLayoutProps> = ({
|
||||
size = 400,
|
||||
presidenteBancada,
|
||||
}) => {
|
||||
// HOOK DE IMAGENES POR DEFECTO
|
||||
useLayoutEffect(() => {
|
||||
// Se ejecuta después de que el componente y el tooltip se hayan renderizado
|
||||
handleImageFallback('.seat-tooltip img', '/default-avatar.png');
|
||||
}, [seatData, presidenteBancada]); // Dependencias: se vuelve a ejecutar si estos datos cambian
|
||||
const uniqueColors = [...new Set(seatData.map(d => d.color))];
|
||||
|
||||
// --- NUEVO ARRAY DE ELEMENTOS ORDENADO ---
|
||||
// --- ARRAY DE ELEMENTOS ORDENADO ---
|
||||
const seatElements = [
|
||||
<circle key="seat-0" id="seat-0" r="12" cy="268.306" cx="202.26" transform="matrix(-0.632908, 0.774227, 0.774227, 0.632908, 0, 0)" />,
|
||||
<circle key="seat-1" id="seat-1" r="12" cy="214.247" cx="223.62" transform="matrix(-0.632908, 0.774227, 0.774227, 0.632908, 0, 0)" />,
|
||||
@@ -135,14 +141,12 @@ export const ParliamentLayout: React.FC<ParliamentLayoutProps> = ({
|
||||
|
||||
const renderedElements = seatElements.map((child, index) => {
|
||||
// --- CASO ESPECIAL: ASIENTO PRESIDENCIAL ---
|
||||
if (index === PRESIDENTE_SEAT_INDEX) {
|
||||
if (presidenteBancada && index === PRESIDENTE_SEAT_INDEX) {
|
||||
return React.cloneElement(child, {
|
||||
fill: presidenteBancada?.color || '#A9A9A9',
|
||||
fill: presidenteBancada.color || '#A9A9A9',
|
||||
stroke: '#000000',
|
||||
strokeWidth: 2,
|
||||
// Le damos un tooltip genérico al presidente
|
||||
'data-tooltip-id': 'seat-tooltip',
|
||||
'data-tooltip-html': `<div class="seat-tooltip"><p>Presidencia de la Cámara</p></div>`
|
||||
'data-tooltip-id': 'seat-tooltip'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// src/components/SenateLayout.tsx
|
||||
import React from 'react';
|
||||
import React, { useLayoutEffect } from 'react';
|
||||
import { handleImageFallback } from './imageFallback';
|
||||
|
||||
// Interfaces
|
||||
interface SeatFillData {
|
||||
@@ -14,7 +15,7 @@ interface SeatFillData {
|
||||
interface SenateLayoutProps {
|
||||
seatData: SeatFillData[];
|
||||
size?: number;
|
||||
presidenteBancada: { color: string | null } | null;
|
||||
presidenteBancada?: { color: string | null } | null;
|
||||
}
|
||||
|
||||
const PRESIDENTE_SEAT_INDEX = 45; // El último asiento (índice 45 de 46)
|
||||
@@ -24,6 +25,12 @@ export const SenateLayout: React.FC<SenateLayoutProps> = ({
|
||||
size = 400,
|
||||
presidenteBancada,
|
||||
}) => {
|
||||
// HOOK DE IMAGENES POR DEFECTO
|
||||
useLayoutEffect(() => {
|
||||
// Se ejecuta después de que el componente y el tooltip se hayan renderizado
|
||||
handleImageFallback('.seat-tooltip img', '/default-avatar.png');
|
||||
}, [seatData, presidenteBancada]); // Dependencias: se vuelve a ejecutar si estos datos cambian
|
||||
|
||||
const uniqueColors = [...new Set(seatData.map(d => d.color).filter(Boolean))];
|
||||
|
||||
// --- NUEVO ARRAY DE ELEMENTOS ORDENADO PARA EL SENADO ---
|
||||
@@ -89,14 +96,12 @@ export const SenateLayout: React.FC<SenateLayoutProps> = ({
|
||||
|
||||
const renderedElements = seatElements.map((child, index) => {
|
||||
// --- CASO ESPECIAL: ASIENTO PRESIDENCIAL ---
|
||||
if (index === PRESIDENTE_SEAT_INDEX) {
|
||||
if (presidenteBancada && index === PRESIDENTE_SEAT_INDEX) {
|
||||
return React.cloneElement(child, {
|
||||
fill: presidenteBancada?.color || '#A9A9A9',
|
||||
fill: presidenteBancada.color || '#A9A9A9',
|
||||
stroke: '#000000',
|
||||
strokeWidth: 2,
|
||||
// Le damos un tooltip genérico al presidente
|
||||
'data-tooltip-id': 'seat-tooltip',
|
||||
'data-tooltip-html': `<div class="seat-tooltip"><p>Presidencia de la Cámara</p></div>`
|
||||
'data-tooltip-id': 'seat-tooltip'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
13
Elecciones-Web/frontend/src/components/imageFallback.ts
Normal file
13
Elecciones-Web/frontend/src/components/imageFallback.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
// src/components/imageFallback.ts
|
||||
|
||||
export function handleImageFallback(selector: string, fallbackImageUrl: string) {
|
||||
// Le decimos a TypeScript que el resultado será una lista de elementos de imagen HTML
|
||||
const images: NodeListOf<HTMLImageElement> = document.querySelectorAll(selector);
|
||||
|
||||
images.forEach(img => {
|
||||
// Ahora que 'img' es de tipo HTMLImageElement, TypeScript sabe que 'onerror' y 'src' son válidos.
|
||||
img.onerror = () => {
|
||||
img.src = fallbackImageUrl;
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -311,19 +311,47 @@ public class ResultadosController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
// En ResultadosController.cs
|
||||
private async Task<IActionResult> GetComposicionDesdeBancadasOficiales(Dictionary<string, string> config)
|
||||
{
|
||||
var bancadas = await _dbContext.Bancadas.AsNoTracking()
|
||||
.Include(b => b.AgrupacionPolitica)
|
||||
.Include(b => b.Ocupante)
|
||||
.ToListAsync();
|
||||
config.TryGetValue("MostrarOcupantes", out var mostrarOcupantesValue);
|
||||
bool mostrarOcupantes = mostrarOcupantesValue == "true";
|
||||
|
||||
IQueryable<Bancada> bancadasQuery = _dbContext.Bancadas.AsNoTracking()
|
||||
.Include(b => b.AgrupacionPolitica);
|
||||
if (mostrarOcupantes)
|
||||
{
|
||||
bancadasQuery = bancadasQuery.Include(b => b.Ocupante);
|
||||
}
|
||||
var bancadas = await bancadasQuery.ToListAsync();
|
||||
|
||||
var bancasPorAgrupacion = bancadas
|
||||
.Where(b => b.AgrupacionPolitica != null)
|
||||
.GroupBy(b => b.AgrupacionPolitica)
|
||||
.Select(g => new { Agrupacion = g.Key!, Camara = g.First().Camara, BancasTotales = g.Count() })
|
||||
// Agrupamos por el ID del partido, que es un valor único y estable
|
||||
.GroupBy(b => b.AgrupacionPolitica!.Id)
|
||||
.Select(g =>
|
||||
{
|
||||
// Tomamos la información de la agrupación del primer elemento (todas son iguales)
|
||||
var primeraBancaDelGrupo = g.First();
|
||||
var agrupacion = primeraBancaDelGrupo.AgrupacionPolitica!;
|
||||
|
||||
// Filtramos los ocupantes solo para este grupo
|
||||
var ocupantesDelPartido = mostrarOcupantes
|
||||
? g.Select(b => b.Ocupante).Where(o => o != null).ToList()
|
||||
: new List<OcupanteBanca?>();
|
||||
|
||||
return new
|
||||
{
|
||||
Agrupacion = agrupacion,
|
||||
Camara = primeraBancaDelGrupo.Camara,
|
||||
BancasTotales = g.Count(),
|
||||
Ocupantes = ocupantesDelPartido
|
||||
};
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// --- FIN DE LA CORRECCIÓN CLAVE ---
|
||||
|
||||
var presidenteDiputados = bancasPorAgrupacion
|
||||
.Where(b => b.Camara == Core.Enums.TipoCamara.Diputados)
|
||||
.OrderByDescending(b => b.BancasTotales)
|
||||
@@ -332,43 +360,34 @@ public class ResultadosController : ControllerBase
|
||||
config.TryGetValue("PresidenciaSenadores", out var idPartidoPresidenteSenadores);
|
||||
var presidenteSenadores = await _dbContext.AgrupacionesPoliticas.FindAsync(idPartidoPresidenteSenadores);
|
||||
|
||||
object MapearPartidosOficial(Core.Enums.TipoCamara camara)
|
||||
object MapearPartidos(Core.Enums.TipoCamara camara)
|
||||
{
|
||||
// 1. Filtramos las bancadas que nos interesan (por cámara y que tengan partido).
|
||||
var partidosDeCamara = bancasPorAgrupacion.Where(b => b.Camara == camara);
|
||||
|
||||
// 2. --- ¡EL CAMBIO CLAVE ESTÁ AQUÍ! ---
|
||||
// Agrupamos por el ID de la Agrupación, no por el objeto.
|
||||
// Esto garantiza que todas las bancadas del mismo partido terminen en el MISMO grupo.
|
||||
if (camara == Core.Enums.TipoCamara.Diputados)
|
||||
partidosDeCamara = partidosDeCamara.OrderBy(p => p.Agrupacion.OrdenDiputados ?? 999);
|
||||
else
|
||||
partidosDeCamara = partidosDeCamara.OrderBy(p => p.Agrupacion.OrdenSenadores ?? 999);
|
||||
|
||||
// 3. Ordenamos, como antes, pero ahora sobre una lista de grupos correcta.
|
||||
var partidosOrdenados = (camara == Core.Enums.TipoCamara.Diputados)
|
||||
? partidosDeCamara.OrderBy(p => p.Agrupacion.OrdenDiputados ?? 999)
|
||||
: partidosDeCamara.OrderBy(p => p.Agrupacion.OrdenSenadores ?? 999);
|
||||
|
||||
// 4. Mapeamos al resultado final.
|
||||
return partidosDeCamara.Select(p => new
|
||||
return partidosDeCamara
|
||||
.OrderByDescending(p => p.BancasTotales)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Agrupacion.Id,
|
||||
p.Agrupacion.Nombre,
|
||||
p.Agrupacion.NombreCorto,
|
||||
p.Agrupacion.Color,
|
||||
p.BancasTotales,
|
||||
// Adjuntamos la lista de ocupantes para este partido
|
||||
Ocupantes = bancadas
|
||||
.Where(b => b.AgrupacionPoliticaId == p.Agrupacion.Id && b.Camara == p.Camara && b.Ocupante != null)
|
||||
.Select(b => b.Ocupante)
|
||||
.ToList()
|
||||
p.Ocupantes // Pasamos la lista de ocupantes ya filtrada
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
// El resto del método permanece igual...
|
||||
var diputados = new
|
||||
{
|
||||
CamaraNombre = "Cámara de Diputados",
|
||||
TotalBancas = 92,
|
||||
BancasEnJuego = 0,
|
||||
Partidos = MapearPartidosOficial(Core.Enums.TipoCamara.Diputados),
|
||||
Partidos = MapearPartidos(Core.Enums.TipoCamara.Diputados),
|
||||
PresidenteBancada = presidenteDiputados != null ? new { presidenteDiputados.Color } : null
|
||||
};
|
||||
|
||||
@@ -377,7 +396,7 @@ public class ResultadosController : ControllerBase
|
||||
CamaraNombre = "Cámara de Senadores",
|
||||
TotalBancas = 46,
|
||||
BancasEnJuego = 0,
|
||||
Partidos = MapearPartidosOficial(Core.Enums.TipoCamara.Senadores),
|
||||
Partidos = MapearPartidos(Core.Enums.TipoCamara.Senadores),
|
||||
PresidenteBancada = presidenteSenadores != null ? new { presidenteSenadores.Color } : null
|
||||
};
|
||||
|
||||
@@ -471,7 +490,14 @@ public class ResultadosController : ControllerBase
|
||||
var bancadasConOcupantes = await _dbContext.Bancadas
|
||||
.AsNoTracking()
|
||||
.Include(b => b.Ocupante)
|
||||
.Select(b => new { b.Id, b.Camara, b.AgrupacionPoliticaId, Ocupante = b.Ocupante })
|
||||
.Select(b => new
|
||||
{
|
||||
b.Id,
|
||||
b.Camara,
|
||||
b.NumeroBanca,
|
||||
b.AgrupacionPoliticaId,
|
||||
Ocupante = b.Ocupante
|
||||
})
|
||||
.OrderBy(b => b.Id)
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
@@ -107,18 +107,26 @@ using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var bancas = new List<Bancada>();
|
||||
// 92 bancas de diputados
|
||||
for (int i = 0; i < 92; i++)
|
||||
for (int i = 1; i <= 92; i++) // Bucle de 1 a 92
|
||||
{
|
||||
bancas.Add(new Bancada { Camara = Elecciones.Core.Enums.TipoCamara.Diputados });
|
||||
bancas.Add(new Bancada
|
||||
{
|
||||
Camara = Elecciones.Core.Enums.TipoCamara.Diputados,
|
||||
NumeroBanca = i // Asignamos el número de banca
|
||||
});
|
||||
}
|
||||
// 46 bancas de senadores
|
||||
for (int i = 0; i < 46; i++)
|
||||
for (int i = 1; i <= 46; i++) // Bucle de 1 a 46
|
||||
{
|
||||
bancas.Add(new Bancada { Camara = Elecciones.Core.Enums.TipoCamara.Senadores });
|
||||
bancas.Add(new Bancada
|
||||
{
|
||||
Camara = Elecciones.Core.Enums.TipoCamara.Senadores,
|
||||
NumeroBanca = i // Asignamos el número de banca
|
||||
});
|
||||
}
|
||||
context.Bancadas.AddRange(bancas);
|
||||
context.SaveChanges();
|
||||
Console.WriteLine("--> Seeded 138 empty bancas.");
|
||||
Console.WriteLine("--> Seeded 138 bancas físicas.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Api")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1ed9a49a5373209c105168d721df4c77b6c1f329")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3b8c6bf754cff6ace486ae8fe850ed4d69233280")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Api")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Api")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"GlobalPropertiesHash":"b5T/+ta4fUd8qpIzUTm3KyEwAYYUsU5ASo+CSFM3ByE=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["BNGxWTPjjFD1Fj56FltRDUvsBzgMlQvuqV\u002BraH2IhwQ=","t631p0kaOa0gMRIcaPzz1ZVPZ1kuq4pq4kYPWQgoPcM=","PA/Beu9jJpOBY5r5Y1CiSyqrARA2j7LHeWYUnEZpQO8=","ywKm3DCyXg4YCbZAIx3JUlT8N4Irff3GswYUVDST\u002BjQ=","6WTvWQ72AaZBYOVSmaxaci9tc1dW5p7IK9Kscjj2cb0=","vAy46VJ9Gp8QqG/Px4J1mj8jL6ws4/A01UKRmMYfYek=","cdgbHR/E4DJsddPc\u002BTpzoUMOVNaFJZm33Pw7AxU9Ees=","4r4JGR4hS5m4rsLfuCSZxzrknTBxKFkLQDXc\u002B2KbqTU=","yVoZ4UnBcSOapsJIi046hnn7ylD3jAcEBUxQ\u002Brkvj/4=","/GfbpJthEWmsuz0uFx1QLHM7gyM1wLLeQgAIl4SzUD4=","i5\u002B5LcfxQD8meRAkQbVf4wMvjxSE4\u002BjCd2/FdPtMpms=","AvSkxVPIg0GjnB1RJ4hDNyo9p9GONrzDs8uVuixH\u002BOE=","IgT9pOgRnK37qfILj2QcjFoBZ180HMt\u002BScgje2iYOo4=","ezUlOMzNZmyKDIe1wwXqvX\u002BvhwfB992xNVts7r2zcTc=","y2BV4WpkQuLfqQhfOQBtmuzh940c3s4LAopGKfztfTE=","XNJwPCDHDCECwfNSMw\u002B6U9bmP9Oc1zMcX0NwP0k5bF8=","P8JRhYPpULTLMAydvl3Ky\u002B92/tYDIjui0l66En4aXuQ=","T1/vt/jpzUAMkv7\u002BVei1e0uBlnnKJZz40wzx6s2b4L0="],"CachedAssets":{},"CachedCopyCandidates":{}}
|
||||
{"GlobalPropertiesHash":"b5T/+ta4fUd8qpIzUTm3KyEwAYYUsU5ASo+CSFM3ByE=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["BNGxWTPjjFD1Fj56FltRDUvsBzgMlQvuqV\u002BraH2IhwQ=","t631p0kaOa0gMRIcaPzz1ZVPZ1kuq4pq4kYPWQgoPcM=","PA/Beu9jJpOBY5r5Y1CiSyqrARA2j7LHeWYUnEZpQO8=","ywKm3DCyXg4YCbZAIx3JUlT8N4Irff3GswYUVDST\u002BjQ=","6WTvWQ72AaZBYOVSmaxaci9tc1dW5p7IK9Kscjj2cb0=","vAy46VJ9Gp8QqG/Px4J1mj8jL6ws4/A01UKRmMYfYek=","cdgbHR/E4DJsddPc\u002BTpzoUMOVNaFJZm33Pw7AxU9Ees=","4r4JGR4hS5m4rsLfuCSZxzrknTBxKFkLQDXc\u002B2KbqTU=","yVoZ4UnBcSOapsJIi046hnn7ylD3jAcEBUxQ\u002Brkvj/4=","/GfbpJthEWmsuz0uFx1QLHM7gyM1wLLeQgAIl4SzUD4=","i5\u002B5LcfxQD8meRAkQbVf4wMvjxSE4\u002BjCd2/FdPtMpms=","AvSkxVPIg0GjnB1RJ4hDNyo9p9GONrzDs8uVuixH\u002BOE=","IgT9pOgRnK37qfILj2QcjFoBZ180HMt\u002BScgje2iYOo4=","ezUlOMzNZmyKDIe1wwXqvX\u002BvhwfB992xNVts7r2zcTc=","y2BV4WpkQuLfqQhfOQBtmuzh940c3s4LAopGKfztfTE=","lHTUEsMkDu8nqXtfTwl7FRfgocyyc7RI5O/edTHN1\u002B0=","BlOQCaw/bt9UsCnDEIqO6LwzwEh4i0OxBfeIZgKDR4U=","P8JRhYPpULTLMAydvl3Ky\u002B92/tYDIjui0l66En4aXuQ=","2x9HRdaMF3CjEHo\u002BFx\u002BfhG7CTomq/ExTkOKw2bUeHms="],"CachedAssets":{},"CachedCopyCandidates":{}}
|
||||
@@ -1 +1 @@
|
||||
{"GlobalPropertiesHash":"tJTBjV/i0Ihkc6XuOu69wxL8PBac9c9Kak6srMso4pU=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["BNGxWTPjjFD1Fj56FltRDUvsBzgMlQvuqV\u002BraH2IhwQ=","t631p0kaOa0gMRIcaPzz1ZVPZ1kuq4pq4kYPWQgoPcM=","PA/Beu9jJpOBY5r5Y1CiSyqrARA2j7LHeWYUnEZpQO8=","ywKm3DCyXg4YCbZAIx3JUlT8N4Irff3GswYUVDST\u002BjQ=","6WTvWQ72AaZBYOVSmaxaci9tc1dW5p7IK9Kscjj2cb0=","vAy46VJ9Gp8QqG/Px4J1mj8jL6ws4/A01UKRmMYfYek=","cdgbHR/E4DJsddPc\u002BTpzoUMOVNaFJZm33Pw7AxU9Ees=","4r4JGR4hS5m4rsLfuCSZxzrknTBxKFkLQDXc\u002B2KbqTU=","yVoZ4UnBcSOapsJIi046hnn7ylD3jAcEBUxQ\u002Brkvj/4=","/GfbpJthEWmsuz0uFx1QLHM7gyM1wLLeQgAIl4SzUD4=","i5\u002B5LcfxQD8meRAkQbVf4wMvjxSE4\u002BjCd2/FdPtMpms=","AvSkxVPIg0GjnB1RJ4hDNyo9p9GONrzDs8uVuixH\u002BOE=","IgT9pOgRnK37qfILj2QcjFoBZ180HMt\u002BScgje2iYOo4=","ezUlOMzNZmyKDIe1wwXqvX\u002BvhwfB992xNVts7r2zcTc=","y2BV4WpkQuLfqQhfOQBtmuzh940c3s4LAopGKfztfTE=","XNJwPCDHDCECwfNSMw\u002B6U9bmP9Oc1zMcX0NwP0k5bF8=","P8JRhYPpULTLMAydvl3Ky\u002B92/tYDIjui0l66En4aXuQ=","T1/vt/jpzUAMkv7\u002BVei1e0uBlnnKJZz40wzx6s2b4L0="],"CachedAssets":{},"CachedCopyCandidates":{}}
|
||||
{"GlobalPropertiesHash":"tJTBjV/i0Ihkc6XuOu69wxL8PBac9c9Kak6srMso4pU=","FingerprintPatternsHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","PropertyOverridesHash":"8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=","InputHashes":["BNGxWTPjjFD1Fj56FltRDUvsBzgMlQvuqV\u002BraH2IhwQ=","t631p0kaOa0gMRIcaPzz1ZVPZ1kuq4pq4kYPWQgoPcM=","PA/Beu9jJpOBY5r5Y1CiSyqrARA2j7LHeWYUnEZpQO8=","ywKm3DCyXg4YCbZAIx3JUlT8N4Irff3GswYUVDST\u002BjQ=","6WTvWQ72AaZBYOVSmaxaci9tc1dW5p7IK9Kscjj2cb0=","vAy46VJ9Gp8QqG/Px4J1mj8jL6ws4/A01UKRmMYfYek=","cdgbHR/E4DJsddPc\u002BTpzoUMOVNaFJZm33Pw7AxU9Ees=","4r4JGR4hS5m4rsLfuCSZxzrknTBxKFkLQDXc\u002B2KbqTU=","yVoZ4UnBcSOapsJIi046hnn7ylD3jAcEBUxQ\u002Brkvj/4=","/GfbpJthEWmsuz0uFx1QLHM7gyM1wLLeQgAIl4SzUD4=","i5\u002B5LcfxQD8meRAkQbVf4wMvjxSE4\u002BjCd2/FdPtMpms=","AvSkxVPIg0GjnB1RJ4hDNyo9p9GONrzDs8uVuixH\u002BOE=","IgT9pOgRnK37qfILj2QcjFoBZ180HMt\u002BScgje2iYOo4=","ezUlOMzNZmyKDIe1wwXqvX\u002BvhwfB992xNVts7r2zcTc=","y2BV4WpkQuLfqQhfOQBtmuzh940c3s4LAopGKfztfTE=","lHTUEsMkDu8nqXtfTwl7FRfgocyyc7RI5O/edTHN1\u002B0=","BlOQCaw/bt9UsCnDEIqO6LwzwEh4i0OxBfeIZgKDR4U=","P8JRhYPpULTLMAydvl3Ky\u002B92/tYDIjui0l66En4aXuQ=","2x9HRdaMF3CjEHo\u002BFx\u002BfhG7CTomq/ExTkOKw2bUeHms="],"CachedAssets":{},"CachedCopyCandidates":{}}
|
||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Core")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1ed9a49a5373209c105168d721df4c77b6c1f329")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3b8c6bf754cff6ace486ae8fe850ed4d69233280")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Core")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Core")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -13,6 +13,9 @@ public class Bancada
|
||||
[Required]
|
||||
public TipoCamara Camara { get; set; }
|
||||
|
||||
[Required]
|
||||
public int NumeroBanca { get; set; }
|
||||
|
||||
public string? AgrupacionPoliticaId { get; set; }
|
||||
|
||||
[ForeignKey("AgrupacionPoliticaId")]
|
||||
|
||||
516
Elecciones-Web/src/Elecciones.Database/Migrations/20250830124636_AddNumeroBancaToBancadas.Designer.cs
generated
Normal file
516
Elecciones-Web/src/Elecciones.Database/Migrations/20250830124636_AddNumeroBancaToBancadas.Designer.cs
generated
Normal file
@@ -0,0 +1,516 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Elecciones.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Elecciones.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(EleccionesDbContext))]
|
||||
[Migration("20250830124636_AddNumeroBancaToBancadas")]
|
||||
partial class AddNumeroBancaToBancadas
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.UseCollation("Modern_Spanish_CI_AS")
|
||||
.HasAnnotation("ProductVersion", "9.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.AdminUser", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PasswordSalt")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AdminUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.AgrupacionPolitica", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("IdTelegrama")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LogoUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Nombre")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NombreCorto")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("OrdenDiputados")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("OrdenSenadores")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AgrupacionesPoliticas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.AmbitoGeografico", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CircuitoId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistritoId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("EstablecimientoId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MesaId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MunicipioId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("NivelId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Nombre")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SeccionId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SeccionProvincialId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AmbitosGeograficos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.Bancada", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AgrupacionPoliticaId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("Camara")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("NumeroBanca")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AgrupacionPoliticaId");
|
||||
|
||||
b.ToTable("Bancadas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.CategoriaElectoral", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Nombre")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Orden")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("CategoriasElectorales");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.Configuracion", b =>
|
||||
{
|
||||
b.Property<string>("Clave")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.Property<string>("Valor")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.HasKey("Clave");
|
||||
|
||||
b.ToTable("Configuraciones");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.EstadoRecuento", b =>
|
||||
{
|
||||
b.Property<int>("AmbitoGeograficoId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CategoriaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CantidadElectores")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CantidadVotantes")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("FechaTotalizacion")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("MesasEsperadas")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MesasTotalizadas")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("MesasTotalizadasPorcentaje")
|
||||
.HasPrecision(5, 2)
|
||||
.HasColumnType("decimal(5,2)");
|
||||
|
||||
b.Property<decimal>("ParticipacionPorcentaje")
|
||||
.HasPrecision(5, 2)
|
||||
.HasColumnType("decimal(5,2)");
|
||||
|
||||
b.Property<long>("VotosEnBlanco")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal>("VotosEnBlancoPorcentaje")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<long>("VotosNulos")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal>("VotosNulosPorcentaje")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<long>("VotosRecurridos")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal>("VotosRecurridosPorcentaje")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.HasKey("AmbitoGeograficoId", "CategoriaId");
|
||||
|
||||
b.ToTable("EstadosRecuentos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.EstadoRecuentoGeneral", b =>
|
||||
{
|
||||
b.Property<int>("AmbitoGeograficoId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CategoriaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CantidadElectores")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CantidadVotantes")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("FechaTotalizacion")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("MesasEsperadas")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MesasTotalizadas")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("MesasTotalizadasPorcentaje")
|
||||
.HasPrecision(5, 2)
|
||||
.HasColumnType("decimal(5,2)");
|
||||
|
||||
b.Property<decimal>("ParticipacionPorcentaje")
|
||||
.HasPrecision(5, 2)
|
||||
.HasColumnType("decimal(5,2)");
|
||||
|
||||
b.HasKey("AmbitoGeograficoId", "CategoriaId");
|
||||
|
||||
b.HasIndex("CategoriaId");
|
||||
|
||||
b.ToTable("EstadosRecuentosGenerales");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.OcupanteBanca", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BancadaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FotoUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NombreOcupante")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Periodo")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BancadaId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("OcupantesBancas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.ProyeccionBanca", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AgrupacionPoliticaId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AmbitoGeograficoId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CategoriaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("FechaTotalizacion")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("NroBancas")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AgrupacionPoliticaId");
|
||||
|
||||
b.HasIndex("AmbitoGeograficoId", "CategoriaId", "AgrupacionPoliticaId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ProyeccionesBancas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.ResultadoVoto", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("AgrupacionPoliticaId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AmbitoGeograficoId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("CantidadVotos")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("CategoriaId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("PorcentajeVotos")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AgrupacionPoliticaId");
|
||||
|
||||
b.HasIndex("AmbitoGeograficoId", "CategoriaId", "AgrupacionPoliticaId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ResultadosVotos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.ResumenVoto", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AgrupacionPoliticaId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("AmbitoGeograficoId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("Votos")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal>("VotosPorcentaje")
|
||||
.HasPrecision(5, 2)
|
||||
.HasColumnType("decimal(5,2)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ResumenesVotos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.Telegrama", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AmbitoGeograficoId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ContenidoBase64")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("FechaEscaneo")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("FechaTotalizacion")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Telegramas");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.Bancada", b =>
|
||||
{
|
||||
b.HasOne("Elecciones.Database.Entities.AgrupacionPolitica", "AgrupacionPolitica")
|
||||
.WithMany()
|
||||
.HasForeignKey("AgrupacionPoliticaId");
|
||||
|
||||
b.Navigation("AgrupacionPolitica");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.EstadoRecuento", b =>
|
||||
{
|
||||
b.HasOne("Elecciones.Database.Entities.AmbitoGeografico", "AmbitoGeografico")
|
||||
.WithMany()
|
||||
.HasForeignKey("AmbitoGeograficoId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AmbitoGeografico");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.EstadoRecuentoGeneral", b =>
|
||||
{
|
||||
b.HasOne("Elecciones.Database.Entities.CategoriaElectoral", "CategoriaElectoral")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoriaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CategoriaElectoral");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.OcupanteBanca", b =>
|
||||
{
|
||||
b.HasOne("Elecciones.Database.Entities.Bancada", "Bancada")
|
||||
.WithOne("Ocupante")
|
||||
.HasForeignKey("Elecciones.Database.Entities.OcupanteBanca", "BancadaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Bancada");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.ProyeccionBanca", b =>
|
||||
{
|
||||
b.HasOne("Elecciones.Database.Entities.AgrupacionPolitica", "AgrupacionPolitica")
|
||||
.WithMany()
|
||||
.HasForeignKey("AgrupacionPoliticaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Elecciones.Database.Entities.AmbitoGeografico", "AmbitoGeografico")
|
||||
.WithMany()
|
||||
.HasForeignKey("AmbitoGeograficoId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AgrupacionPolitica");
|
||||
|
||||
b.Navigation("AmbitoGeografico");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.ResultadoVoto", b =>
|
||||
{
|
||||
b.HasOne("Elecciones.Database.Entities.AgrupacionPolitica", "AgrupacionPolitica")
|
||||
.WithMany()
|
||||
.HasForeignKey("AgrupacionPoliticaId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Elecciones.Database.Entities.AmbitoGeografico", "AmbitoGeografico")
|
||||
.WithMany()
|
||||
.HasForeignKey("AmbitoGeograficoId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AgrupacionPolitica");
|
||||
|
||||
b.Navigation("AmbitoGeografico");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elecciones.Database.Entities.Bancada", b =>
|
||||
{
|
||||
b.Navigation("Ocupante");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Elecciones.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddNumeroBancaToBancadas : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "NumeroBanca",
|
||||
table: "Bancadas",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "NumeroBanca",
|
||||
table: "Bancadas");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,6 +137,9 @@ namespace Elecciones.Database.Migrations
|
||||
b.Property<int>("Camara")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("NumeroBanca")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AgrupacionPoliticaId");
|
||||
|
||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Database")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1ed9a49a5373209c105168d721df4c77b6c1f329")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3b8c6bf754cff6ace486ae8fe850ed4d69233280")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Database")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Database")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Infrastructure")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1ed9a49a5373209c105168d721df4c77b6c1f329")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3b8c6bf754cff6ace486ae8fe850ed4d69233280")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Infrastructure")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Infrastructure")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
Reference in New Issue
Block a user