mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
fix(roadtrip): seat rides and the drive into tomorrow by one rule, and say why a way was not taken
The slot the desktop stores for a ride within one day was worked out over the rows the day list shows, so a hotel it hides on the far shore was left out, the ferry was filed behind it and the road trip drove there overland before the crossing. It is now worked out over every stop the drive reads, timed the way the drive times it. An overnight ride no longer seats its arrival by the slot seeded on the day it left, and opens the day it lands on unless somebody placed it there. A via behind a day's last stop goes once that stop is no longer last, for the rail's drags and removals, the list's reorder and the server's sorts and seated nights alike; some of them used to bend a leg of the day through it instead. A leg OSRM drew while the avoidance router did not answer is now known as such: the picker no longer reads it as that router's road, has the leg routed again when its own road is chosen and says so, and a join that fell back is asked for again and flagged on its card. A refused way that leaves a class out names the setting that drives it, the ferry hint covers a crossing that lands the next day, a road another engine timed names that engine, and the desk bar keeps the keyboard on the chip while a choice is checked and announces the outcome. A ride on none of the trip's days is no longer said to have no date.
This commit is contained in:
@@ -128,14 +128,14 @@ describe('booked night reseat', () => {
|
||||
reseatBookedNights(db);
|
||||
|
||||
// The rules the service applies when it moves a night: a via follows the stop
|
||||
// it was drawn after, so A's road is on leg one now and the hotel's on leg
|
||||
// zero; B is last now and has no leg to keep a via on, so its road goes.
|
||||
// it was drawn after, so A's road is on leg one now; B is last now and has no leg
|
||||
// to keep a via on, so its road goes. The hotel's road was the drive into the next
|
||||
// day, behind the last stop, and goes too now that the hotel leads the day: on the
|
||||
// leg out of the hotel it would bend the drive to A through a point on that road.
|
||||
expect(order(db)).toEqual([hotel, a, b]);
|
||||
expect(vias(db)).toEqual([
|
||||
{ id: afterHotel, after_order_index: 0, sequence: 0 },
|
||||
{ id: afterA, after_order_index: 1, sequence: 0 },
|
||||
]);
|
||||
expect(vias(db)).toEqual([{ id: afterA, after_order_index: 1, sequence: 0 }]);
|
||||
expect(vias(db).map((v) => v.id)).not.toContain(afterB);
|
||||
expect(vias(db).map((v) => v.id)).not.toContain(afterHotel);
|
||||
});
|
||||
|
||||
it('RESEAT-006: a road behind the last stop stays with it, and the roads ahead follow their stops', () => {
|
||||
|
||||
@@ -1284,16 +1284,17 @@ describe('the drawn roads a booking moves', () => {
|
||||
const existing = svc.getAccommodation(accommodation.id, trip.id)!;
|
||||
const { mirror } = svc.updateAccommodation(accommodation.id, existing, { check_in: '20:00' }) as any;
|
||||
|
||||
// The night is last now. The road out of it has no leg left and goes; the roads
|
||||
// behind B and C follow them one number up, and the one into the next day is
|
||||
// C's no longer.
|
||||
// The night is last now. The road out of it has no leg left and goes; the road
|
||||
// behind B follows it one number up. The one behind C was the drive into the next
|
||||
// day, which leaves from the hotel now, so it goes as well rather than bending the
|
||||
// drive from C to the hotel through a point on the road to tomorrow.
|
||||
expect(stopsOn(day.id)).toEqual([a.id, b.id, c.id, hotel.id]);
|
||||
expect(viaAnchors(day.id)).toEqual([
|
||||
{ id: afterA, after_order_index: 0 },
|
||||
{ id: afterB, after_order_index: 1 },
|
||||
{ id: afterC, after_order_index: 2 },
|
||||
]);
|
||||
expect(viaAnchors(day.id).map(via => via.id)).not.toContain(afterHotel);
|
||||
expect(viaAnchors(day.id).map(via => via.id)).not.toContain(afterC);
|
||||
expect(mirror.moved).not.toBeNull();
|
||||
expect(mirror.vias).toEqual([{ dayId: day.id, vias: expect.arrayContaining([expect.objectContaining({ id: afterB, after_order_index: 1 })]) }]);
|
||||
});
|
||||
|
||||
@@ -574,9 +574,10 @@ describe('updateTime', () => {
|
||||
});
|
||||
|
||||
it('ASG-SVC-042: a sort that moves the last stop up the day takes the drive behind it along, never leaving it on no stop', () => {
|
||||
// The rule the planner applies too (carriedSeam): a via behind the last stop stays
|
||||
// there only while that stop is last. Once another stop is, the via follows its stop
|
||||
// like any other, and nothing is left on an index behind the day's end.
|
||||
// The rule the planner applies too (seamViaIndex): a via behind the last stop stays
|
||||
// there only while that stop is last. Once another stop is, it goes: it lies on the
|
||||
// road to tomorrow, and read as the leg its stop leaves by now it would bend the
|
||||
// drive from C to A through a point on that road.
|
||||
const { day, ids: [a, b, c] } = dayOf([['09:00', 0], ['12:00', 1], ['18:00', 2]]);
|
||||
const afterA = addVia(day.id, 0);
|
||||
const intoTomorrow = addVia(day.id, 2);
|
||||
@@ -584,10 +585,8 @@ describe('updateTime', () => {
|
||||
const update = svc.updateTime(c, '08:00', null);
|
||||
|
||||
expect(dayOrder(day.id)).toEqual([c, a, b]);
|
||||
expect(viaAnchors(day.id)).toEqual([
|
||||
{ id: afterA, after_order_index: 1, sequence: 0 },
|
||||
{ id: intoTomorrow, after_order_index: 0, sequence: 0 },
|
||||
]);
|
||||
expect(viaAnchors(day.id)).toEqual([{ id: afterA, after_order_index: 1, sequence: 0 }]);
|
||||
expect(viaAnchors(day.id).map(via => via.id)).not.toContain(intoTomorrow);
|
||||
expect(update.vias?.dayId).toBe(day.id);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user