mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 02:14:05 +00:00
fix(tours): keep the shipped ski migrations and follow the ski tour through
The winter label and four-discipline migrations are already on feat/tours-board-rest, so a database that ran them would refuse to boot or fail the old CHECK. 045500, 045520 and 046100 are back as they shipped, and a new migration drops both winter_activity columns and adds ski_discipline again with the six disciplines. The entity and table types follow the column to its new place. German, Hungarian, Indonesian and English no longer name the whole type with the ski touring word, and the info dot speaks of ski tours and tracks. search_tour_pois and its wiki row list rides and ski and winter tours. Snowshoeing gets a snowshoe glyph instead of the walk's footprints, a ski import without a discipline can be planned over (the planner asks for it), and an overlay shown by default tries its tiles afresh each time it comes on.
This commit is contained in:
@@ -244,18 +244,25 @@ describe('useGpxConversion', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('SKI-02: a ski track that names no discipline is not planned over: nothing is offered and no router is asked', () => {
|
||||
it('SKI-02: a ski track that names no discipline is planned over too, the planner asks for it', async () => {
|
||||
const ski = { ...imported, tour_type: 'ski' as const, ski_discipline: null, max_hiking_difficulty: null };
|
||||
const controller = planner({
|
||||
mode: { type: 'view-gpx', placeId: ski.place_id, tour: ski },
|
||||
readOnlyGpxTour: { tour: ski, routeGeometry: null },
|
||||
} as Partial<TourPlannerController>);
|
||||
const { result } = renderHook(() => useGpxConversion(controller));
|
||||
expect(result.current.available).toBe(false);
|
||||
const { container } = render(<TourConversionSection conversion={result.current} />);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
expect(routing.route).not.toHaveBeenCalled();
|
||||
expect(routing.run).not.toHaveBeenCalled();
|
||||
expect(result.current.available).toBe(true);
|
||||
expect(result.current.ski).toBe(true);
|
||||
await act(async () => {
|
||||
await result.current.analyze();
|
||||
});
|
||||
act(() => {
|
||||
result.current.adopt('new');
|
||||
});
|
||||
// Nothing is chosen for the skier: the draft opens without a discipline, and saving waits for one.
|
||||
expect(controller.startDerivedTour).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ tourType: 'ski', ski: { discipline: null, technique: null } })
|
||||
);
|
||||
});
|
||||
|
||||
it('PR1-05B: nothing is adopted before the suggestion is ready', () => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { isTourRoute } from '../planner/tourRouteOutcome';
|
||||
import { routeBikeTour, routeRun, routeWalkingTour } from '../planner/tourRouting';
|
||||
import { paddleFieldsOf } from '../planner/usePaddleFields';
|
||||
import type { TourPlannerController } from '../planner/useTourPlanner';
|
||||
import { skiChoiceMissing, skiChoiceOf } from '../ski/skiChoice';
|
||||
import { skiChoiceOf } from '../ski/skiChoice';
|
||||
import { compareRoutes, deriveControlPoints, type RouteComparison, type TrackPoint } from './gpxConversion';
|
||||
|
||||
/** The grade a planned version routes with when the import carries none: the paths a T3 walk may take. */
|
||||
@@ -132,12 +132,12 @@ export function useGpxConversion(planner: TourPlannerController) {
|
||||
...current,
|
||||
/**
|
||||
* The import shown can be planned from: it has a track and the user may add tours. A ski
|
||||
* track (SKI-02) once it names its discipline, planned as a ski tour with its legs drawn.
|
||||
* track (SKI-02) is planned as a ski tour with its legs drawn; one saved before it named a
|
||||
* discipline is offered too, and the planner asks for the discipline before it saves.
|
||||
* A ride (HOR-01) never: no router plans one, and walking it again on foot would be no ride.
|
||||
*/
|
||||
available:
|
||||
tour !== null &&
|
||||
(ski === null || skiChoiceMissing(ski) === null) &&
|
||||
tour.tour_type !== 'horse' &&
|
||||
(track?.length ?? 0) >= 2 &&
|
||||
planner.canEdit,
|
||||
|
||||
Reference in New Issue
Block a user