Fix EleccionId Workers
This commit is contained in:
		| @@ -9,6 +9,7 @@ namespace Elecciones.Worker; | |||||||
|  |  | ||||||
| public class CriticalDataWorker : BackgroundService | public class CriticalDataWorker : BackgroundService | ||||||
| { | { | ||||||
|  |   private const int EleccionId = 2; | ||||||
|   private readonly ILogger<CriticalDataWorker> _logger; |   private readonly ILogger<CriticalDataWorker> _logger; | ||||||
|   private readonly SharedTokenService _tokenService; |   private readonly SharedTokenService _tokenService; | ||||||
|   private readonly IServiceProvider _serviceProvider; |   private readonly IServiceProvider _serviceProvider; | ||||||
| @@ -155,6 +156,7 @@ public class CriticalDataWorker : BackgroundService | |||||||
|           { |           { | ||||||
|             todasLasProyecciones.Add(new ProyeccionBanca |             todasLasProyecciones.Add(new ProyeccionBanca | ||||||
|             { |             { | ||||||
|  |               EleccionId = EleccionId, | ||||||
|               AmbitoGeograficoId = provincia.Id, |               AmbitoGeograficoId = provincia.Id, | ||||||
|               AgrupacionPoliticaId = banca.IdAgrupacion, |               AgrupacionPoliticaId = banca.IdAgrupacion, | ||||||
|               NroBancas = banca.NroBancas, |               NroBancas = banca.NroBancas, | ||||||
| @@ -194,6 +196,7 @@ public class CriticalDataWorker : BackgroundService | |||||||
|             { |             { | ||||||
|               todasLasProyecciones.Add(new ProyeccionBanca |               todasLasProyecciones.Add(new ProyeccionBanca | ||||||
|               { |               { | ||||||
|  |                 EleccionId = EleccionId, | ||||||
|                 AmbitoGeograficoId = seccion.Id, |                 AmbitoGeograficoId = seccion.Id, | ||||||
|                 AgrupacionPoliticaId = banca.IdAgrupacion, |                 AgrupacionPoliticaId = banca.IdAgrupacion, | ||||||
|                 NroBancas = banca.NroBancas, |                 NroBancas = banca.NroBancas, | ||||||
| @@ -304,6 +307,7 @@ public class CriticalDataWorker : BackgroundService | |||||||
|                     { |                     { | ||||||
|                       var nuevoTelegrama = new Telegrama |                       var nuevoTelegrama = new Telegrama | ||||||
|                       { |                       { | ||||||
|  |                         EleccionId = EleccionId, | ||||||
|                         Id = telegramaFile.NombreArchivo, |                         Id = telegramaFile.NombreArchivo, | ||||||
|                         AmbitoGeograficoId = ambitoMesa.Id, |                         AmbitoGeograficoId = ambitoMesa.Id, | ||||||
|                         ContenidoBase64 = telegramaFile.Imagen, |                         ContenidoBase64 = telegramaFile.Imagen, | ||||||
| @@ -417,7 +421,7 @@ public class CriticalDataWorker : BackgroundService | |||||||
|  |  | ||||||
|     if (estadoRecuento == null) |     if (estadoRecuento == null) | ||||||
|     { |     { | ||||||
|       estadoRecuento = new EstadoRecuento { AmbitoGeograficoId = ambitoId, CategoriaId = categoriaId }; |       estadoRecuento = new EstadoRecuento { EleccionId = EleccionId, AmbitoGeograficoId = ambitoId, CategoriaId = categoriaId }; | ||||||
|       dbContext.EstadosRecuentos.Add(estadoRecuento); |       dbContext.EstadosRecuentos.Add(estadoRecuento); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -477,6 +481,7 @@ public class CriticalDataWorker : BackgroundService | |||||||
|       { |       { | ||||||
|         resultadoVoto = new ResultadoVoto |         resultadoVoto = new ResultadoVoto | ||||||
|         { |         { | ||||||
|  |           EleccionId = EleccionId, | ||||||
|           AmbitoGeograficoId = ambitoId, |           AmbitoGeograficoId = ambitoId, | ||||||
|           CategoriaId = categoriaId, |           CategoriaId = categoriaId, | ||||||
|           AgrupacionPoliticaId = votoPositivoDto.IdAgrupacion |           AgrupacionPoliticaId = votoPositivoDto.IdAgrupacion | ||||||
| @@ -552,6 +557,7 @@ public class CriticalDataWorker : BackgroundService | |||||||
|             { |             { | ||||||
|               dbContext.ResumenesVotos.Add(new ResumenVoto |               dbContext.ResumenesVotos.Add(new ResumenVoto | ||||||
|               { |               { | ||||||
|  |                 EleccionId = EleccionId, | ||||||
|                 AmbitoGeograficoId = provincia.Id, |                 AmbitoGeograficoId = provincia.Id, | ||||||
|                 CategoriaId = categoria.Id, |                 CategoriaId = categoria.Id, | ||||||
|                 AgrupacionPoliticaId = voto.IdAgrupacion, |                 AgrupacionPoliticaId = voto.IdAgrupacion, | ||||||
| @@ -653,6 +659,7 @@ public class CriticalDataWorker : BackgroundService | |||||||
|             // Creamos una nueva instancia de la entidad. |             // Creamos una nueva instancia de la entidad. | ||||||
|             registroDb = new EstadoRecuentoGeneral |             registroDb = new EstadoRecuentoGeneral | ||||||
|             { |             { | ||||||
|  |               EleccionId = EleccionId, | ||||||
|               AmbitoGeograficoId = provincia.Id, |               AmbitoGeograficoId = provincia.Id, | ||||||
|               CategoriaId = categoria.Id // Asignamos ambas partes de la clave primaria. |               CategoriaId = categoria.Id // Asignamos ambas partes de la clave primaria. | ||||||
|             }; |             }; | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ namespace Elecciones.Worker; | |||||||
|  |  | ||||||
| public class LowPriorityDataWorker : BackgroundService | public class LowPriorityDataWorker : BackgroundService | ||||||
| { | { | ||||||
|  |   private const int EleccionId = 2; | ||||||
|   private readonly ILogger<LowPriorityDataWorker> _logger; |   private readonly ILogger<LowPriorityDataWorker> _logger; | ||||||
|   private readonly SharedTokenService _tokenService; |   private readonly SharedTokenService _tokenService; | ||||||
|   private readonly IServiceProvider _serviceProvider; |   private readonly IServiceProvider _serviceProvider; | ||||||
| @@ -139,7 +140,7 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|  |  | ||||||
|     if (estadoRecuento == null) |     if (estadoRecuento == null) | ||||||
|     { |     { | ||||||
|       estadoRecuento = new EstadoRecuento { AmbitoGeograficoId = ambitoId, CategoriaId = categoriaId }; |       estadoRecuento = new EstadoRecuento { EleccionId = EleccionId, AmbitoGeograficoId = ambitoId, CategoriaId = categoriaId }; | ||||||
|       dbContext.EstadosRecuentos.Add(estadoRecuento); |       dbContext.EstadosRecuentos.Add(estadoRecuento); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -199,6 +200,7 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|       { |       { | ||||||
|         resultadoVoto = new ResultadoVoto |         resultadoVoto = new ResultadoVoto | ||||||
|         { |         { | ||||||
|  |           EleccionId = EleccionId, | ||||||
|           AmbitoGeograficoId = ambitoId, |           AmbitoGeograficoId = ambitoId, | ||||||
|           CategoriaId = categoriaId, |           CategoriaId = categoriaId, | ||||||
|           AgrupacionPoliticaId = votoPositivoDto.IdAgrupacion |           AgrupacionPoliticaId = votoPositivoDto.IdAgrupacion | ||||||
| @@ -274,6 +276,7 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|             { |             { | ||||||
|               dbContext.ResumenesVotos.Add(new ResumenVoto |               dbContext.ResumenesVotos.Add(new ResumenVoto | ||||||
|               { |               { | ||||||
|  |                 EleccionId = EleccionId, | ||||||
|                 AmbitoGeograficoId = provincia.Id, |                 AmbitoGeograficoId = provincia.Id, | ||||||
|                 CategoriaId = categoria.Id, |                 CategoriaId = categoria.Id, | ||||||
|                 AgrupacionPoliticaId = voto.IdAgrupacion, |                 AgrupacionPoliticaId = voto.IdAgrupacion, | ||||||
| @@ -375,6 +378,7 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|             // Creamos una nueva instancia de la entidad. |             // Creamos una nueva instancia de la entidad. | ||||||
|             registroDb = new EstadoRecuentoGeneral |             registroDb = new EstadoRecuentoGeneral | ||||||
|             { |             { | ||||||
|  |               EleccionId = EleccionId, | ||||||
|               AmbitoGeograficoId = provincia.Id, |               AmbitoGeograficoId = provincia.Id, | ||||||
|               CategoriaId = categoria.Id // Asignamos ambas partes de la clave primaria. |               CategoriaId = categoria.Id // Asignamos ambas partes de la clave primaria. | ||||||
|             }; |             }; | ||||||
| @@ -628,6 +632,7 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|           { |           { | ||||||
|             todasLasProyecciones.Add(new ProyeccionBanca |             todasLasProyecciones.Add(new ProyeccionBanca | ||||||
|             { |             { | ||||||
|  |               EleccionId = EleccionId, | ||||||
|               AmbitoGeograficoId = provincia.Id, |               AmbitoGeograficoId = provincia.Id, | ||||||
|               AgrupacionPoliticaId = banca.IdAgrupacion, |               AgrupacionPoliticaId = banca.IdAgrupacion, | ||||||
|               NroBancas = banca.NroBancas, |               NroBancas = banca.NroBancas, | ||||||
| @@ -667,6 +672,7 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|             { |             { | ||||||
|               todasLasProyecciones.Add(new ProyeccionBanca |               todasLasProyecciones.Add(new ProyeccionBanca | ||||||
|               { |               { | ||||||
|  |                 EleccionId = EleccionId, | ||||||
|                 AmbitoGeograficoId = seccion.Id, |                 AmbitoGeograficoId = seccion.Id, | ||||||
|                 AgrupacionPoliticaId = banca.IdAgrupacion, |                 AgrupacionPoliticaId = banca.IdAgrupacion, | ||||||
|                 NroBancas = banca.NroBancas, |                 NroBancas = banca.NroBancas, | ||||||
| @@ -777,6 +783,7 @@ public class LowPriorityDataWorker : BackgroundService | |||||||
|                     { |                     { | ||||||
|                       var nuevoTelegrama = new Telegrama |                       var nuevoTelegrama = new Telegrama | ||||||
|                       { |                       { | ||||||
|  |                         EleccionId = EleccionId, | ||||||
|                         Id = telegramaFile.NombreArchivo, |                         Id = telegramaFile.NombreArchivo, | ||||||
|                         AmbitoGeograficoId = ambitoMesa.Id, |                         AmbitoGeograficoId = ambitoMesa.Id, | ||||||
|                         ContenidoBase64 = telegramaFile.Imagen, |                         ContenidoBase64 = telegramaFile.Imagen, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user