- Añadidas alternativas que permiten incorporarse directamente al segundo sentido de una línea circular cuando ofrecen mejor puntuación.

- Corregida la pérdida del historial personal al pulsar Historial inmediatamente después de recargar la aplicación.
- Evitadas escrituras y eliminaciones antes de completar la carga de localStorage.
- Oscurecido el amarillo de la línea 40 para mejorar su visibilidad sobre el mapa.
- Actualizada la versión de la aplicación a v-20260713a.
This commit is contained in:
2026-07-13 15:00:47 +02:00
parent 582ab14138
commit 4c71402e24
5 changed files with 240 additions and 15 deletions

View File

@@ -52,7 +52,7 @@ public partial class PlanificadorRutas : ComponentBase, IDisposable
try { await JS.InvokeVoidAsync("rt.blockLeafletDoubleClick"); } catch (Exception ex) { Console.WriteLine("rt.blockLeafletDoubleClick: " + ex); }
try { await JS.InvokeVoidAsync("rt.initDraggablePopups"); } catch (Exception ex) { Console.WriteLine("rt.initDraggablePopups: " + ex); }
await CargarConfiguracionLocalAsync();
await CargarHistorialLocalAsync();
await AsegurarHistorialLocalCargadoAsync();
await CargarHistorialCompartidoAsync();
await CargarModelosHorariosAsync();

View File

@@ -24,6 +24,8 @@ public partial class PlanificadorRutas
private bool _omitirRegistroHistorialEnSiguienteCalculo = false;
private string? _historialCompartidoPendienteEliminarId;
private ConfiguracionLocalPlanificador? _configuracionTemporalPreviaHistorial;
private Task<bool>? _tareaCargaHistorialLocal;
private bool _historialLocalCargado = false;
private async Task ToggleHistorialPanel()
{
@@ -35,41 +37,69 @@ public partial class PlanificadorRutas
return;
}
if (!await AsegurarHistorialLocalCargadoAsync())
{
MostrarMensajeHistorial("No he podido cargar el historial personal. Intentalo de nuevo.", esError: true);
return;
}
_mostrarHistorialRutas = true;
await CargarHistorialCompartidoAsync();
StartRefrescoHistorialCompartido();
}
private async Task CargarHistorialLocalAsync()
private async Task<bool> AsegurarHistorialLocalCargadoAsync()
{
if (_historialLocalCargado)
return true;
_tareaCargaHistorialLocal ??= CargarHistorialLocalDesdeNavegadorAsync();
var tareaCarga = _tareaCargaHistorialLocal;
var cargado = await tareaCarga;
if (!cargado && ReferenceEquals(_tareaCargaHistorialLocal, tareaCarga))
_tareaCargaHistorialLocal = null;
return cargado;
}
private async Task<bool> CargarHistorialLocalDesdeNavegadorAsync()
{
try
{
var json = await JS.InvokeAsync<string?>("rt.loadLocalValue", ClaveHistorialLocal);
if (string.IsNullOrWhiteSpace(json))
return;
if (!string.IsNullOrWhiteSpace(json))
{
var items = JsonSerializer.Deserialize<List<RegistroHistorialRuta>>(json);
if (items is null)
return false;
var items = JsonSerializer.Deserialize<List<RegistroHistorialRuta>>(json);
if (items is null)
return;
_historialLocal.Clear();
_historialLocal.AddRange(items
.Where(x => !string.IsNullOrWhiteSpace(x.Id))
.OrderByDescending(x => x.FechaActualizacionUtc)
.Take(MaxItemsHistorialLocal));
_historialLocal.Clear();
_historialLocal.AddRange(items
.Where(x => !string.IsNullOrWhiteSpace(x.Id))
.OrderByDescending(x => x.FechaActualizacionUtc)
.Take(MaxItemsHistorialLocal));
}
_historialLocalSeleccionadoId = _historialLocal.FirstOrDefault()?.Id ?? string.Empty;
_historialLocalCargado = true;
return true;
}
catch (JSException)
{
return false;
}
catch (JsonException)
{
return false;
}
}
private async Task PersistirHistorialLocalAsync()
{
if (!_historialLocalCargado)
return;
try
{
var json = JsonSerializer.Serialize(_historialLocal);
@@ -157,6 +187,9 @@ public partial class PlanificadorRutas
private async Task RegistrarEscenarioActualEnHistorialLocalAsync()
{
if (!await AsegurarHistorialLocalCargadoAsync())
return;
var actual = ConstruirRegistroHistorialActual();
if (actual is null)
return;
@@ -287,6 +320,9 @@ public partial class PlanificadorRutas
private async Task EliminarHistorialLocalAsync(string id)
{
if (!await AsegurarHistorialLocalCargadoAsync())
return;
var item = _historialLocal.FirstOrDefault(x => x.Id == id);
if (item is null)
return;

View File

@@ -1261,7 +1261,7 @@ public partial class PlanificadorRutas : ComponentBase
private bool _elevPopupMinimizado = false;
private const string _versionApp = "(v-20260710a)";
private const string _versionApp = "(v-20260713a)";
private double? _paradaElevG;