reloj desancalado de la configuracion hasta recalcular
This commit is contained in:
@@ -1503,7 +1503,7 @@ public partial class PlanificadorRutas : ComponentBase
|
||||
private bool _elevPopupMinimizado = false;
|
||||
|
||||
|
||||
private const string _versionApp = "(v-20260918a)";
|
||||
private const string _versionApp = "(v-20260918b)";
|
||||
|
||||
|
||||
private double? _paradaElevIdee;
|
||||
|
||||
@@ -1305,6 +1305,12 @@ public partial class PlanificadorRutas : ComponentBase
|
||||
await PersistirConfiguracionConfirmadaAsync();
|
||||
MarcarConfiguracionAvanzadaComoGuardada();
|
||||
|
||||
if (_usarHoraSimulada)
|
||||
StopClock();
|
||||
else
|
||||
StartClock();
|
||||
await RefrescarHoraUIAsync();
|
||||
|
||||
if (_coordenadasOrigen is null || _coordenadasDestino is null)
|
||||
{
|
||||
StateHasChanged();
|
||||
|
||||
@@ -253,15 +253,18 @@ public partial class PlanificadorRutas : ComponentBase
|
||||
var ahora = DateTime.Now;
|
||||
_fechaSimulada = DateOnly.FromDateTime(ahora);
|
||||
_horaSimulada = TimeOnly.FromDateTime(ahora);
|
||||
StopClock();
|
||||
}
|
||||
else
|
||||
{
|
||||
StartClock();
|
||||
}
|
||||
|
||||
await RefrescarHoraUIAsync();
|
||||
await PersistirConfiguracionAsync();
|
||||
if (!_editandoConfiguracionAvanzada)
|
||||
{
|
||||
if (_usarHoraSimulada)
|
||||
StopClock();
|
||||
else
|
||||
StartClock();
|
||||
|
||||
await RefrescarHoraUIAsync();
|
||||
await PersistirConfiguracionAsync();
|
||||
}
|
||||
}
|
||||
|
||||
// ====== HORA (real / simulada) ======
|
||||
@@ -308,10 +311,13 @@ public partial class PlanificadorRutas : ComponentBase
|
||||
if (!string.IsNullOrWhiteSpace(s) && DateOnly.TryParse(s, out var d))
|
||||
_fechaSimulada = d;
|
||||
|
||||
if (_usarHoraSimulada)
|
||||
await RefrescarHoraUIAsync();
|
||||
if (!_editandoConfiguracionAvanzada)
|
||||
{
|
||||
if (_usarHoraSimulada)
|
||||
await RefrescarHoraUIAsync();
|
||||
|
||||
await PersistirConfiguracionAsync();
|
||||
await PersistirConfiguracionAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -323,10 +329,13 @@ public partial class PlanificadorRutas : ComponentBase
|
||||
if (!string.IsNullOrWhiteSpace(s) && TimeOnly.TryParse(s, out var t))
|
||||
_horaSimulada = t;
|
||||
|
||||
if (_usarHoraSimulada)
|
||||
await RefrescarHoraUIAsync();
|
||||
if (!_editandoConfiguracionAvanzada)
|
||||
{
|
||||
if (_usarHoraSimulada)
|
||||
await RefrescarHoraUIAsync();
|
||||
|
||||
await PersistirConfiguracionAsync();
|
||||
await PersistirConfiguracionAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -338,10 +347,13 @@ public partial class PlanificadorRutas : ComponentBase
|
||||
_fechaSimulada = DateOnly.FromDateTime(ahora);
|
||||
_horaSimulada = TimeOnly.FromDateTime(ahora);
|
||||
|
||||
if (_usarHoraSimulada)
|
||||
await RefrescarHoraUIAsync();
|
||||
if (!_editandoConfiguracionAvanzada)
|
||||
{
|
||||
if (_usarHoraSimulada)
|
||||
await RefrescarHoraUIAsync();
|
||||
|
||||
await PersistirConfiguracionAsync();
|
||||
await PersistirConfiguracionAsync();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
@@ -369,7 +381,11 @@ public partial class PlanificadorRutas : ComponentBase
|
||||
while (await _clockTimer.WaitForNextTickAsync(_clockCts.Token))
|
||||
{
|
||||
// ✅ Solo actualizamos si NO estamos en simulada
|
||||
if (_usarHoraSimulada) continue;
|
||||
var usarHoraSimuladaAplicada = _editandoConfiguracionAvanzada &&
|
||||
_configuracionAvanzadaAplicada is not null
|
||||
? _configuracionAvanzadaAplicada.UsarHoraSimulada
|
||||
: _usarHoraSimulada;
|
||||
if (usarHoraSimuladaAplicada) continue;
|
||||
|
||||
var now = DateTime.Now;
|
||||
var es = new CultureInfo("es-ES");
|
||||
|
||||
@@ -438,6 +438,27 @@ Check((bool)puntoDentro.Invoke(null, new object?[] { 43.3155, -1.9845, parametro
|
||||
"Las paradas interiores a una zona se detectan antes de calcular");
|
||||
var page = new PlanificadorRutas();
|
||||
var flags = BindingFlags.Instance | BindingFlags.NonPublic;
|
||||
var paginaRelojEnEdicion = new PlanificadorRutas();
|
||||
typeof(PlanificadorRutas).GetField("_editandoConfiguracionAvanzada", flags)!
|
||||
.SetValue(paginaRelojEnEdicion, true);
|
||||
typeof(PlanificadorRutas).GetField("_usarHoraSimulada", flags)!
|
||||
.SetValue(paginaRelojEnEdicion, true);
|
||||
typeof(PlanificadorRutas).GetField("_horaAhoraTxt", flags)!
|
||||
.SetValue(paginaRelojEnEdicion, "Hora aplicada");
|
||||
var cambiarHoraSimulada = typeof(PlanificadorRutas).GetMethod(
|
||||
"OnChangeHoraSimulada", flags)!;
|
||||
await (Task)cambiarHoraSimulada.Invoke(
|
||||
paginaRelojEnEdicion,
|
||||
new object[]
|
||||
{
|
||||
new Microsoft.AspNetCore.Components.ChangeEventArgs { Value = "18:45" }
|
||||
})!;
|
||||
Check(
|
||||
(string)typeof(PlanificadorRutas).GetField("_horaAhoraTxt", flags)!
|
||||
.GetValue(paginaRelojEnEdicion)! == "Hora aplicada" &&
|
||||
(TimeOnly)typeof(PlanificadorRutas).GetField("_horaSimulada", flags)!
|
||||
.GetValue(paginaRelojEnEdicion)! == new TimeOnly(18, 45),
|
||||
"Editar la hora deja el reloj aplicado intacto hasta guardar y recalcular");
|
||||
var fabricaHistorial = (ConfiguracionHistorialRuta)baseMethod.Invoke(null, null)!;
|
||||
fabricaHistorial.FactorEquilibradoAndarBus = 6;
|
||||
fabricaHistorial.UsarHoraSimulada = true;
|
||||
|
||||
Reference in New Issue
Block a user