Self-heal stale saved plans on load (days Nov / stays Sep)
Plans persisted by the old re-anchoring have November day dates but September hotel stays, so covers() matched nothing and the base chip / per-day hotel anchoring were wrong. enterTrip now runs the idempotent redateStaysAndPlaces() after loading a saved plan and re-persists, so a stale plan heals itself on the next load without a re-upload.
This commit is contained in:
parent
16c35b0bce
commit
6c90a656bd
|
|
@ -2088,6 +2088,11 @@ function enterTrip(id) {
|
||||||
days = deep(saved.days); stays = deep(saved.stays); version = saved.version; history = saved.history; hIdx = saved.hIdx;
|
days = deep(saved.days); stays = deep(saved.stays); version = saved.version; history = saved.history; hIdx = saved.hIdx;
|
||||||
if (saved.bookings) M.trip.bookings = deep(saved.bookings);
|
if (saved.bookings) M.trip.bookings = deep(saved.bookings);
|
||||||
if (saved.title != null) M.trip.title = saved.title;
|
if (saved.title != null) M.trip.title = saved.title;
|
||||||
|
// self-heal plans saved by the old re-anchoring, which re-dated the days
|
||||||
|
// but not the stays (hotel nights then no longer "covered" any day);
|
||||||
|
// idempotent — a consistent plan is a no-op
|
||||||
|
redateStaysAndPlaces();
|
||||||
|
persistTrip();
|
||||||
}
|
}
|
||||||
tripDocs = {}; // rehydrated from the server store below
|
tripDocs = {}; // rehydrated from the server store below
|
||||||
// reset per-trip UI state
|
// reset per-trip UI state
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user