The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(tours): preset a ski tour's actual track as ski, and cover the run and ride presets
Mauricee40e576e39f0
diff --git a/client/src/components/Tours/activity/tourActivityModel.test.ts b/client/src/components/Tours/activity/tourActivityModel.test.tsindex 2bf2952c7..a5db75d1b 100644--- a/client/src/components/Tours/activity/tourActivityModel.test.ts+++ b/client/src/components/Tours/activity/tourActivityModel.test.ts@@ -120,6 +120,26 @@ describe('the GPX preset', () => {});expect(importFieldsFor(tour({ tour_type: 'walk' }))).toEqual({ tour_type: 'walk' });expect(importFieldsFor(tour({ tour_type: 'ski' }))).toEqual({ tour_type: 'hike' });+ expect(importFieldsFor(tour({ tour_type: 'ski', ski_discipline: 'touring', ski_technique: null }))).toEqual({+ tour_type: 'ski',+ ski_discipline: 'touring',+ });+ const skating = { tour_type: 'ski', ski_discipline: 'cross_country', ski_technique: 'skating' } as const;+ expect(importFieldsFor(tour(skating))).toEqual(skating);+ expect(importFieldsFor(tour({ tour_type: 'ski', ski_discipline: 'cross_country', ski_technique: null }))).toEqual({+ tour_type: 'ski',+ ski_discipline: 'cross_country',+ ski_technique: 'unknown',+ });+ expect(importFieldsFor(tour({ tour_type: 'run', run_profile: 'trail' }))).toEqual({+ tour_type: 'run',+ run_profile: 'trail',+ });+ expect(importFieldsFor(tour({ tour_type: 'run', run_profile: null }))).toEqual({+ tour_type: 'run',+ run_profile: 'running',+ });+ expect(importFieldsFor(tour({ tour_type: 'horse' }))).toEqual({ tour_type: 'horse' });});});diff --git a/client/src/components/Tours/activity/tourActivityModel.ts b/client/src/components/Tours/activity/tourActivityModel.tsindex 95f6e34c5..60652e89a 100644--- a/client/src/components/Tours/activity/tourActivityModel.ts+++ b/client/src/components/Tours/activity/tourActivityModel.ts@@ -80,15 +80,24 @@ export function trackCandidates(tours: readonly TourListItem[], placeId: number)/*** The type a recording of this tour is imported as, preset in the GPX- * preview: the tour's own, with its bike or run profile or its boat and water where- * it has them. A type the import does not offer starts as a hike, as the- * preview always did.+ * preview: the tour's own, with its bike or run profile, its boat and water,+ * or its ski discipline and technique where it has them. A type the import+ * does not offer, and a ski tour without a discipline (which the import+ * refuses for ski), starts as a hike, as the preview always did.*/export function importFieldsFor(tour: Pick<TourListItem, 'tour_type' | 'bike_profile' | 'boat_type' | 'water_context'> &- Partial<Pick<TourListItem, 'run_profile'>>+ Partial<Pick<TourListItem, 'run_profile' | 'ski_discipline' | 'ski_technique'>>): TourGpxImportFields {switch (tour.tour_type) {+ case 'ski':+ if (!tour.ski_discipline) return { tour_type: 'hike' };+ return {+ tour_type: 'ski',+ ski_discipline: tour.ski_discipline,+ // Only cross-country is done in a technique; unknown when the travellers did not know it.+ ...(tour.ski_discipline === 'cross_country' ? { ski_technique: tour.ski_technique ?? 'unknown' } : {}),+ };case 'bike':return { tour_type: 'bike', bike_profile: tour.bike_profile ?? 'touring' };case 'run':