mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fde123e87 | |||
| 3bc75d2b1c | |||
| 094426debb | |||
| 313198ba63 | |||
| e677d58f91 | |||
| bc60aea839 | |||
| b5cd951bd2 |
@@ -32,7 +32,7 @@ jobs:
|
||||
version: ${{ steps.bump.outputs.VERSION }}
|
||||
sha: ${{ steps.bump.outputs.SHA }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -107,7 +107,7 @@ jobs:
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
run: echo "PLATFORM_PAIR=${PLATFORM//\//-}" >> "$GITHUB_ENV"
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ needs.version-bump.outputs.sha }}
|
||||
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
timeout-minutes: 120
|
||||
needs: [version-bump, build]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ needs.version-bump.outputs.sha }}
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
app-id: ${{ secrets.RELEASE_APP_ID }}
|
||||
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
@@ -179,7 +179,7 @@ jobs:
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
run: echo "PLATFORM_PAIR=${PLATFORM//\//-}" >> "$GITHUB_ENV"
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ needs.version-bump.outputs.sha }}
|
||||
|
||||
@@ -229,7 +229,7 @@ jobs:
|
||||
timeout-minutes: 120
|
||||
needs: [version-bump, build]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ needs.version-bump.outputs.sha }}
|
||||
|
||||
@@ -294,7 +294,7 @@ jobs:
|
||||
needs: version-bump
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ needs.version-bump.outputs.sha }}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
run:
|
||||
working-directory: plugin-sdk
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
# The Node the TREK image runs the plugins on. It has the node:sqlite
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
+19
-19
@@ -127,7 +127,7 @@ jobs:
|
||||
image: ${{ steps.areas.outputs.image }}
|
||||
deploy: ${{ steps.areas.outputs.deploy }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
# On a pull request HEAD is the merge commit GitHub builds of the PR
|
||||
# into its base, and its first parent is the base, so two commits
|
||||
@@ -202,7 +202,7 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -218,7 +218,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -289,7 +289,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -437,7 +437,7 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -532,7 +532,7 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -572,7 +572,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -603,7 +603,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -670,7 +670,7 @@ jobs:
|
||||
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -765,7 +765,7 @@ jobs:
|
||||
--health-timeout 5s
|
||||
--health-retries 20
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -817,7 +817,7 @@ jobs:
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4, 5, 6, 7]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -861,7 +861,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -906,7 +906,7 @@ jobs:
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4, 5, 6, 7]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -945,7 +945,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -984,7 +984,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -1018,7 +1018,7 @@ jobs:
|
||||
working-directory: plugin-sdk
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
@@ -1069,7 +1069,7 @@ jobs:
|
||||
- plugin-sdk
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
# Sonar reads git blame to date each issue and to decide what counts
|
||||
# as new code. A shallow clone leaves it blind to both.
|
||||
@@ -1133,7 +1133,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -1226,7 +1226,7 @@ jobs:
|
||||
KUBECONFORM_VERSION: v0.8.0
|
||||
KUBECONFORM_SHA256: 9bc2bffbf71f261128533edaf912153948b7ff238f9a531ae6d34466ec287883
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
- name: Publish to GitHub wiki
|
||||
uses: Andrew-Chen-Wang/github-wiki-action@1bbb4280446f9630e8e21a18012cbacf3b0f992e # v5.0.6
|
||||
with:
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
// Build server/assets/airports.json from OurAirports (davidmegginson.github.io/ourairports-data).
|
||||
// License: Public Domain. Keeps large/medium airports with an IATA code; timezone derived from coords via tz-lookup.
|
||||
// License: Public Domain. Keeps large/medium airports with an IATA code, small ones only with scheduled service;
|
||||
// timezone derived from coords via tz-lookup.
|
||||
import fs from 'node:fs';
|
||||
import https from 'node:https';
|
||||
import path from 'node:path';
|
||||
@@ -91,7 +92,9 @@ for (let i = 1; i < rows.length; i++) {
|
||||
if (!KEEP.has(r[TYPE])) continue;
|
||||
const iata = r[IATA]?.trim().toUpperCase();
|
||||
if (!iata || iata.length !== 3) continue;
|
||||
if (r[SERVICE] !== 'yes') continue;
|
||||
// The scheduled_service flag lags reality: Little Cayman (LYB) has daily flights and is
|
||||
// marked "no". So it only filters the small fields, where it keeps every airstrip with a code out.
|
||||
if (r[TYPE] === 'small_airport' && r[SERVICE] !== 'yes') continue;
|
||||
const lat = Number(r[LAT]);
|
||||
const lng = Number(r[LNG]);
|
||||
if (!Number.isFinite(lat) || !Number.isFinite(lng)) continue;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"scripts/db-call-graph.mjs": 1036,
|
||||
"scripts/generate-entities.ts": 2259,
|
||||
"src/db/repositories/Places.repository.ts": 1439,
|
||||
"src/db/repositories/Places.repository.ts": 1438,
|
||||
"src/db/repositories/Reservations.repository.ts": 1604,
|
||||
"src/db/repositories/Trips.repository.ts": 1121,
|
||||
"src/db/repositories/Users.repository.ts": 1445,
|
||||
|
||||
@@ -605,16 +605,15 @@ export class PlacesRepository extends TrekRepository<Places> {
|
||||
* it was.
|
||||
*/
|
||||
async listDedupInputs(trip_id: string): Promise<{
|
||||
name: string | null; lat: number | null; lng: number | null;
|
||||
name: string | null; lat: number | null; lng: number | null; route_geometry: string | null;
|
||||
google_place_id: string | null; google_ftid: string | null; osm_id: string | null; amap_poi_id: string | null;
|
||||
}[]> {
|
||||
// route_geometry tells a track from a pin: a track to import matches only tracks (#2810).
|
||||
return this.qb('p')
|
||||
.select(['p.name', 'p.lat', 'p.lng', 'p.google_place_id', 'p.google_ftid', 'p.osm_id', 'p.amap_poi_id'])
|
||||
.select(['p.name', 'p.lat', 'p.lng', 'p.route_geometry',
|
||||
'p.google_place_id', 'p.google_ftid', 'p.osm_id', 'p.amap_poi_id'])
|
||||
.where('p.trip_id = ?', [trip_id])
|
||||
.execute<{
|
||||
name: string | null; lat: number | null; lng: number | null;
|
||||
google_place_id: string | null; google_ftid: string | null; osm_id: string | null; amap_poi_id: string | null;
|
||||
}[]>('all', false);
|
||||
.execute<Awaited<ReturnType<PlacesRepository['listDedupInputs']>>>('all', false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,11 +86,16 @@ export async function reclaimPhotoCache(
|
||||
|
||||
export interface DedupSet {
|
||||
names: Set<string>;
|
||||
/** The names of the places with a line: a track to import matches only these (#2810). Absent where none is read. */
|
||||
trackNames?: Set<string>;
|
||||
coords: Array<{ lat: number; lng: number }>;
|
||||
/** Provider ids (google_place_id, google_ftid, osm_id, amap_poi_id) of the places already in the trip. */
|
||||
externalIds: Set<string>;
|
||||
}
|
||||
|
||||
/** A candidate for the dedup set; `track` when it is a line (a GPX track or route, a KML path). */
|
||||
export type DedupCandidate = PlaceMatchCandidate & { track?: boolean };
|
||||
|
||||
/**
|
||||
* Returns true if a candidate place is already represented in the dedup set.
|
||||
*
|
||||
@@ -104,12 +109,14 @@ export interface DedupSet {
|
||||
* JavaScript's is not, and only unnamed rows contribute coordinates to a dedup
|
||||
* set. `findDuplicatePlace` spells out where the two still answer differently.
|
||||
*/
|
||||
export function isPlaceDuplicate(candidate: PlaceMatchCandidate, dedup: DedupSet): boolean {
|
||||
export function isPlaceDuplicate(candidate: DedupCandidate, dedup: DedupSet): boolean {
|
||||
for (const strategy of placeMatchStrategies(candidate)) {
|
||||
if (strategy.by === 'externalId') {
|
||||
if (dedup.externalIds.has(strategy.id)) return true;
|
||||
} else if (strategy.by === 'name') {
|
||||
if (dedup.names.has(strategy.name)) return true;
|
||||
// A track is the same as a track of that name, never as a sight of that name:
|
||||
// a watch names a hike after the place it went to (#2810).
|
||||
if ((candidate.track ? dedup.trackNames : dedup.names)?.has(strategy.name)) return true;
|
||||
} else if (
|
||||
dedup.coords.some(
|
||||
(c) =>
|
||||
@@ -130,29 +137,34 @@ export function isPlaceDuplicate(candidate: PlaceMatchCandidate, dedup: DedupSet
|
||||
*/
|
||||
export function dedupSetOf(
|
||||
rows: ReadonlyArray<
|
||||
{ name: string | null; lat: number | null; lng: number | null } & Parameters<typeof externalIdsOf>[0]
|
||||
{ name: string | null; lat: number | null; lng: number | null; route_geometry?: string | null } & Parameters<
|
||||
typeof externalIdsOf
|
||||
>[0]
|
||||
>,
|
||||
): DedupSet {
|
||||
const names = new Set<string>();
|
||||
const trackNames = new Set<string>();
|
||||
const coords: Array<{ lat: number; lng: number }> = [];
|
||||
const externalIds = new Set<string>();
|
||||
for (const row of rows) {
|
||||
for (const id of externalIdsOf(row)) externalIds.add(id);
|
||||
if (row.name) {
|
||||
names.add(row.name.trim().toLowerCase());
|
||||
if (row.route_geometry) trackNames.add(row.name.trim().toLowerCase());
|
||||
} else if (row.lat != null && row.lng != null) {
|
||||
coords.push({ lat: row.lat, lng: row.lng });
|
||||
}
|
||||
}
|
||||
return { names, coords, externalIds };
|
||||
return { names, trackNames, coords, externalIds };
|
||||
}
|
||||
|
||||
/** Record a newly inserted place so subsequent candidates in the same batch are checked against it. */
|
||||
export function trackInsertedInDedupSet(place: PlaceMatchCandidate, dedup: DedupSet): void {
|
||||
export function trackInsertedInDedupSet(place: DedupCandidate, dedup: DedupSet): void {
|
||||
for (const id of externalIdsOf(place)) dedup.externalIds.add(id);
|
||||
const normalizedName = normalizePlaceName(place.name);
|
||||
if (normalizedName) {
|
||||
dedup.names.add(normalizedName);
|
||||
if (place.track) (dedup.trackNames ??= new Set()).add(normalizedName);
|
||||
} else if (place.lat != null && place.lng != null) {
|
||||
dedup.coords.push({ lat: place.lat, lng: place.lng });
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ export class PlacesService {
|
||||
async gpxDuplicates(tripId: string, rows: PreparedGpxPlace[]): Promise<boolean[]> {
|
||||
const dedup = await this.buildDedupSet(tripId);
|
||||
return rows.map((wp) => {
|
||||
const candidate = { name: wp.name, lat: wp.lat, lng: wp.lng };
|
||||
const candidate = { name: wp.name, lat: wp.lat, lng: wp.lng, track: !!wp.routeGeometry };
|
||||
if (isPlaceDuplicate(candidate, dedup)) return true;
|
||||
trackInsertedInDedupSet(candidate, dedup);
|
||||
return false;
|
||||
@@ -925,7 +925,7 @@ export class PlacesService {
|
||||
// `findWithTagsAndRatings` INSIDE the caller's transaction, so the read
|
||||
// sees the still-uncommitted row.
|
||||
for (const wp of waypoints) {
|
||||
if (isPlaceDuplicate({ name: wp.name, lat: wp.lat, lng: wp.lng }, dedup)) {
|
||||
if (isPlaceDuplicate({ name: wp.name, lat: wp.lat, lng: wp.lng, track: !!wp.routeGeometry }, dedup)) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
@@ -960,7 +960,7 @@ export class PlacesService {
|
||||
});
|
||||
const place = (await this.placesRepo.findWithTagsAndRatings(placeId))!;
|
||||
created.push(place);
|
||||
trackInsertedInDedupSet({ name: wp.name, lat: wp.lat, lng: wp.lng }, dedup);
|
||||
trackInsertedInDedupSet({ name: wp.name, lat: wp.lat, lng: wp.lng, track: !!wp.routeGeometry }, dedup);
|
||||
}
|
||||
|
||||
return { places: created, count: created.length, skipped };
|
||||
@@ -1033,7 +1033,7 @@ export class PlacesService {
|
||||
const fallbackName = `Placemark ${fallbackIndex}`;
|
||||
const name = parsedPlacemark.name || fallbackName;
|
||||
|
||||
if (isPlaceDuplicate({ name, lat: parsedPlacemark.lat, lng: parsedPlacemark.lng }, dedup)) {
|
||||
if (isPlaceDuplicate({ name, lat: parsedPlacemark.lat, lng: parsedPlacemark.lng, track: isPath }, dedup)) {
|
||||
summary.skippedCount += 1;
|
||||
dupCount++;
|
||||
fallbackIndex += 1;
|
||||
@@ -1079,7 +1079,7 @@ export class PlacesService {
|
||||
|
||||
const place = (await this.placesRepo.findWithTagsAndRatings(placeId))!;
|
||||
created.push(place);
|
||||
trackInsertedInDedupSet({ name, lat: parsedPlacemark.lat, lng: parsedPlacemark.lng }, dedup);
|
||||
trackInsertedInDedupSet({ name, lat: parsedPlacemark.lat, lng: parsedPlacemark.lng, track: isPath }, dedup);
|
||||
summary.createdCount += 1;
|
||||
fallbackIndex += 1;
|
||||
}
|
||||
|
||||
@@ -565,6 +565,21 @@ describe('Tours e2e (real guards + temp SQLite)', () => {
|
||||
expect((await importGpx(OWNER, TRACK_GPX)).body).toEqual({ tours: [], caution: false, skipped: 1 });
|
||||
});
|
||||
|
||||
it('imports a hike named after a sight of the trip instead of skipping it as a duplicate (#2810)', async () => {
|
||||
// A watch names the hike after where it went, and that place is already planned.
|
||||
const sight = (await makePlace(orm, 5, { name: 'alpine loop', lat: 47, lng: 11 })).id;
|
||||
|
||||
const preview = await previewGpx(OWNER, TRACK_GPX);
|
||||
expect(preview.body.tracks[0]).toMatchObject({ name: 'Alpine loop', duplicate: false });
|
||||
|
||||
const res = await importGpx(OWNER, TRACK_GPX);
|
||||
expect(res.status).toBe(201);
|
||||
expect(res.body).toMatchObject({ skipped: 0 });
|
||||
expect(res.body.tours).toHaveLength(1);
|
||||
expect(res.body.tours[0].place_id).not.toBe(sight);
|
||||
expect(await placeColumns(sight, 'route_geometry')).toEqual({ route_geometry: null });
|
||||
});
|
||||
|
||||
it('400 without a file, and for a file with no track or route', async () => {
|
||||
const missing = await importGpx(OWNER, null);
|
||||
expect(missing.status).toBe(400);
|
||||
|
||||
@@ -574,20 +574,21 @@ describe('PlacesRepository.listForGpx (PL29) and existsByImageUrl (PI1)', () =>
|
||||
* by, the service-level dedup tests.
|
||||
*/
|
||||
describe('PlacesRepository.listDedupInputs (PL24)', () => {
|
||||
it('PLACEREPO-048: projects exactly the seven dedup columns, scoped to the trip', async () => {
|
||||
it('PLACEREPO-048: projects exactly the eight dedup columns, the line included (#2810), scoped to the trip', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
const trip = createTrip(testDb, user.id);
|
||||
const other = createTrip(testDb, user.id);
|
||||
await insertRow(t.orm, Places, {
|
||||
trip: trip.id, name: 'Louvre', lat: 48.86, lng: 2.34, google_place_id: 'gp1', google_ftid: 'ft1', osm_id: 'osm1', amap_poi_id: 'amap1',
|
||||
route_geometry: '[[48.86,2.34],[48.87,2.35]]',
|
||||
});
|
||||
await insertRow(t.orm, Places, { trip: trip.id, name: '', lat: 1.1, lng: 2.2 });
|
||||
createPlace(testDb, other.id, { name: 'Not this trip' });
|
||||
|
||||
const rows = await places.listDedupInputs(String(trip.id));
|
||||
expect(rows).toEqual([
|
||||
{ name: 'Louvre', lat: 48.86, lng: 2.34, google_place_id: 'gp1', google_ftid: 'ft1', osm_id: 'osm1', amap_poi_id: 'amap1' },
|
||||
{ name: '', lat: 1.1, lng: 2.2, google_place_id: null, google_ftid: null, osm_id: null, amap_poi_id: null },
|
||||
{ name: 'Louvre', lat: 48.86, lng: 2.34, route_geometry: '[[48.86,2.34],[48.87,2.35]]', google_place_id: 'gp1', google_ftid: 'ft1', osm_id: 'osm1', amap_poi_id: 'amap1' },
|
||||
{ name: '', lat: 1.1, lng: 2.2, route_geometry: null, google_place_id: null, google_ftid: null, osm_id: null, amap_poi_id: null },
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* The bundled assets/airports.json itself, not a fixture.
|
||||
*
|
||||
* OurAirports marks some airports with daily flights as having no scheduled
|
||||
* service, and the build used to drop them on that flag alone (#2820, Little
|
||||
* Cayman). These pin a few of them and the codes saved bookings already point at.
|
||||
*/
|
||||
import { findByIata } from '../../../../src/nest/airports/airports.data';
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('bundled airport dataset', () => {
|
||||
it('AIRPORT-ASSET-001: keeps airports OurAirports flags as unscheduled', () => {
|
||||
expect(findByIata('LYB')?.name).toBe('Edward Bodden Little Cayman Airfield');
|
||||
expect(findByIata('VEY')?.country).toBe('IS');
|
||||
});
|
||||
|
||||
it('AIRPORT-ASSET-002: still resolves the codes it carried before', () => {
|
||||
for (const code of ['PBI', 'ADA', 'GCM', 'CYB', 'FRA']) {
|
||||
expect(findByIata(code), code).not.toBeNull();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -247,7 +247,7 @@ describe('what the engine reads', () => {
|
||||
|
||||
expect(travel.entries.map((e) => [e.id, e.title, e.mood])).toEqual([[entry.id, 'Alfama', 'amazing']]);
|
||||
expect(travel.locale).toBe('de-DE');
|
||||
expect(travel.labels).toMatchObject({ day: 'TAG {day}', stations: 'Stationen', pros: 'Pro', cons: 'Contra' });
|
||||
expect(travel.labels).toMatchObject({ day: 'TAG {day}', stations: 'Unterwegs', pros: 'Pro', cons: 'Contra' });
|
||||
expect(travel.path).toEqual([]);
|
||||
expect((await edit.wordsFor(owner.id)).locale).toBe('de-DE');
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('the book words', () => {
|
||||
expect(french.locale).toBe('fr-FR');
|
||||
expect(french.labels).toMatchObject({
|
||||
day: 'JOUR {day}',
|
||||
stations: 'Étapes',
|
||||
stations: 'En chemin',
|
||||
summary: 'Résumé',
|
||||
countries: 'Pays',
|
||||
});
|
||||
@@ -30,7 +30,7 @@ describe('the book words', () => {
|
||||
locale: 'en-US',
|
||||
labels: {
|
||||
day: 'DAY {day}',
|
||||
stations: 'Stations',
|
||||
stations: 'Along the way',
|
||||
summary: 'Summary',
|
||||
countries: 'Countries',
|
||||
distance: 'Distance',
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
import {
|
||||
COORD_DEDUP_TOLERANCE,
|
||||
dedupSetOf,
|
||||
externalIdsOf,
|
||||
isPlaceDuplicate,
|
||||
mapWithConcurrency,
|
||||
@@ -25,6 +26,29 @@ vi.mock('../../../src/db/database', () => ({
|
||||
const emptyDedup = (): DedupSet => ({ names: new Set(), coords: [], externalIds: new Set() });
|
||||
|
||||
describe('isPlaceDuplicate / trackInsertedInDedupSet', () => {
|
||||
it('matches a track only against the tracks of that name, never a sight of that name (#2810)', () => {
|
||||
// The watch named the hike after the gorge, and the gorge is already a place of the trip.
|
||||
const dedup = dedupSetOf([
|
||||
{ name: 'Hokitika Gorge', lat: -42.95, lng: 171.0, route_geometry: null },
|
||||
{ name: ' 008 ', lat: 1, lng: 2, route_geometry: '[[1,2],[3,4]]' },
|
||||
]);
|
||||
expect(isPlaceDuplicate({ name: 'hokitika gorge', lat: -42.9, lng: 171.0, track: true }, dedup)).toBe(false);
|
||||
expect(isPlaceDuplicate({ name: '008', lat: 1, lng: 2, track: true }, dedup)).toBe(true);
|
||||
// A pin still matches every place of its name, a track included.
|
||||
expect(isPlaceDuplicate({ name: 'Hokitika Gorge', lat: null, lng: null }, dedup)).toBe(true);
|
||||
expect(isPlaceDuplicate({ name: '008', lat: null, lng: null }, dedup)).toBe(true);
|
||||
|
||||
// A track imported earlier in the same file counts for the next one.
|
||||
trackInsertedInDedupSet({ name: 'Hokitika Gorge', lat: -42.9, lng: 171.0, track: true }, dedup);
|
||||
expect(isPlaceDuplicate({ name: 'Hokitika gorge ', lat: null, lng: null, track: true }, dedup)).toBe(true);
|
||||
// A set built by hand without tracks matches no track by name.
|
||||
const bare = emptyDedup();
|
||||
trackInsertedInDedupSet({ name: 'Ridge', lat: 1, lng: 2 }, bare);
|
||||
expect(isPlaceDuplicate({ name: 'Ridge', lat: 1, lng: 2, track: true }, bare)).toBe(false);
|
||||
trackInsertedInDedupSet({ name: 'Lake', lat: 1, lng: 2, track: true }, bare);
|
||||
expect([...(bare.trackNames ?? [])]).toEqual(['lake']);
|
||||
});
|
||||
|
||||
it('matches a named place case- and whitespace-insensitively', () => {
|
||||
const dedup = emptyDedup();
|
||||
trackInsertedInDedupSet({ name: ' Eiffel Tower ', lat: 1, lng: 2 }, dedup);
|
||||
|
||||
@@ -321,7 +321,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'تخطيط تلقائي',
|
||||
'journey.studio.export': 'تصدير',
|
||||
'journey.studio.day': 'اليوم {day}',
|
||||
'journey.studio.stations': 'المحطات',
|
||||
'journey.studio.stations': 'على الطريق',
|
||||
'journey.studio.peersHere': 'هنا',
|
||||
'journey.studio.folioAuto': 'تلقائي',
|
||||
'journey.studio.exportLayout': 'التخطيط',
|
||||
|
||||
@@ -323,7 +323,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Avtomatik tərtibat',
|
||||
'journey.studio.export': 'İxrac et',
|
||||
'journey.studio.day': 'GÜN {day}',
|
||||
'journey.studio.stations': 'Dayanacaqlar',
|
||||
'journey.studio.stations': 'Yol boyunca',
|
||||
'journey.studio.peersHere': 'burada',
|
||||
'journey.studio.folioAuto': 'Avtomatik',
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Layout automático',
|
||||
'journey.studio.export': 'Exportar',
|
||||
'journey.studio.day': 'DIA {day}',
|
||||
'journey.studio.stations': 'Etapas',
|
||||
'journey.studio.stations': 'Pelo caminho',
|
||||
'journey.studio.peersHere': 'aqui',
|
||||
'journey.studio.folioAuto': 'Automático',
|
||||
'journey.studio.exportLayout': 'Layout', // same-as-en
|
||||
|
||||
@@ -298,7 +298,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Disseny automàtic',
|
||||
'journey.studio.export': 'Exporta',
|
||||
'journey.studio.day': 'DIA {day}',
|
||||
'journey.studio.stations': 'Etapes',
|
||||
'journey.studio.stations': 'Pel camí',
|
||||
'journey.studio.peersHere': 'aquí',
|
||||
'journey.studio.folioAuto': 'Automàtic',
|
||||
'journey.studio.exportLayout': 'Disposició',
|
||||
|
||||
@@ -304,7 +304,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Automatické rozvržení',
|
||||
'journey.studio.export': 'Exportovat',
|
||||
'journey.studio.day': 'DEN {day}',
|
||||
'journey.studio.stations': 'Zastávky',
|
||||
'journey.studio.stations': 'Cestou',
|
||||
'journey.studio.peersHere': 'zde',
|
||||
'journey.studio.folioAuto': 'Automaticky',
|
||||
'journey.studio.exportLayout': 'Rozvržení',
|
||||
|
||||
@@ -300,7 +300,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Automatisch anordnen',
|
||||
'journey.studio.export': 'Exportieren',
|
||||
'journey.studio.day': 'TAG {day}',
|
||||
'journey.studio.stations': 'Stationen',
|
||||
'journey.studio.stations': 'Unterwegs',
|
||||
'journey.studio.peersHere': 'hier',
|
||||
'journey.studio.folioAuto': 'Automatisch',
|
||||
'journey.studio.exportLayout': 'Layout', // same-as-en
|
||||
|
||||
@@ -297,7 +297,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Auto layout',
|
||||
'journey.studio.export': 'Export',
|
||||
'journey.studio.day': 'DAY {day}',
|
||||
'journey.studio.stations': 'Stations',
|
||||
'journey.studio.stations': 'Along the way',
|
||||
'journey.studio.peersHere': 'here',
|
||||
'journey.studio.folioAuto': 'Automatic',
|
||||
'journey.studio.exportLayout': 'Layout',
|
||||
|
||||
@@ -299,7 +299,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Diseño automático',
|
||||
'journey.studio.export': 'Exportar',
|
||||
'journey.studio.day': 'DÍA {day}',
|
||||
'journey.studio.stations': 'Etapas',
|
||||
'journey.studio.stations': 'Por el camino',
|
||||
'journey.studio.peersHere': 'aquí',
|
||||
'journey.studio.folioAuto': 'Automático',
|
||||
'journey.studio.exportLayout': 'Diseño',
|
||||
|
||||
@@ -299,7 +299,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Automaatne paigutus',
|
||||
'journey.studio.export': 'Eksport',
|
||||
'journey.studio.day': '{day}. PÄEV',
|
||||
'journey.studio.stations': 'Peatused',
|
||||
'journey.studio.stations': 'Teel',
|
||||
'journey.studio.peersHere': 'siin',
|
||||
'journey.studio.folioAuto': 'Automaatne',
|
||||
'journey.studio.exportLayout': 'Paigutus',
|
||||
|
||||
@@ -299,7 +299,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Mise en page auto',
|
||||
'journey.studio.export': 'Exporter',
|
||||
'journey.studio.day': 'JOUR {day}',
|
||||
'journey.studio.stations': 'Étapes',
|
||||
'journey.studio.stations': 'En chemin',
|
||||
'journey.studio.peersHere': 'ici',
|
||||
'journey.studio.folioAuto': 'Automatique',
|
||||
'journey.studio.exportLayout': 'Mise en page',
|
||||
|
||||
@@ -302,7 +302,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Αυτόματη διάταξη',
|
||||
'journey.studio.export': 'Εξαγωγή',
|
||||
'journey.studio.day': 'ΗΜΕΡΑ {day}',
|
||||
'journey.studio.stations': 'Στάσεις',
|
||||
'journey.studio.stations': 'Στη διαδρομή',
|
||||
'journey.studio.peersHere': 'εδώ',
|
||||
'journey.studio.folioAuto': 'Αυτόματα',
|
||||
'journey.studio.exportLayout': 'Διάταξη',
|
||||
|
||||
@@ -298,7 +298,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Automatikus elrendezés',
|
||||
'journey.studio.export': 'Exportálás',
|
||||
'journey.studio.day': '{day}. NAP',
|
||||
'journey.studio.stations': 'Állomások',
|
||||
'journey.studio.stations': 'Útközben',
|
||||
'journey.studio.peersHere': 'itt',
|
||||
'journey.studio.folioAuto': 'Automatikus',
|
||||
'journey.studio.exportLayout': 'Elrendezés',
|
||||
|
||||
@@ -291,7 +291,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Tata letak otomatis',
|
||||
'journey.studio.export': 'Ekspor',
|
||||
'journey.studio.day': 'HARI {day}',
|
||||
'journey.studio.stations': 'Persinggahan',
|
||||
'journey.studio.stations': 'Sepanjang jalan',
|
||||
'journey.studio.peersHere': 'di sini',
|
||||
'journey.studio.folioAuto': 'Otomatis',
|
||||
'journey.studio.exportLayout': 'Tata letak',
|
||||
|
||||
@@ -298,7 +298,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Layout automatico',
|
||||
'journey.studio.export': 'Esporta',
|
||||
'journey.studio.day': 'GIORNO {day}',
|
||||
'journey.studio.stations': 'Tappe',
|
||||
'journey.studio.stations': 'Lungo la strada',
|
||||
'journey.studio.peersHere': 'qui',
|
||||
'journey.studio.folioAuto': 'Automatico',
|
||||
'journey.studio.exportLayout': 'Impaginazione',
|
||||
|
||||
@@ -290,7 +290,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': '自動レイアウト',
|
||||
'journey.studio.export': 'エクスポート',
|
||||
'journey.studio.day': '{day}日目',
|
||||
'journey.studio.stations': '立ち寄り先',
|
||||
'journey.studio.stations': '道中で',
|
||||
'journey.studio.peersHere': '閲覧中',
|
||||
'journey.studio.folioAuto': '自動',
|
||||
'journey.studio.exportLayout': 'レイアウト',
|
||||
|
||||
@@ -287,7 +287,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': '자동 레이아웃',
|
||||
'journey.studio.export': '내보내기',
|
||||
'journey.studio.day': '{day}일차',
|
||||
'journey.studio.stations': '경유지',
|
||||
'journey.studio.stations': '가는 길에',
|
||||
'journey.studio.peersHere': '접속 중',
|
||||
'journey.studio.folioAuto': '자동',
|
||||
'journey.studio.exportLayout': '레이아웃',
|
||||
|
||||
@@ -300,7 +300,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Automatische opmaak',
|
||||
'journey.studio.export': 'Exporteren',
|
||||
'journey.studio.day': 'DAG {day}',
|
||||
'journey.studio.stations': 'Etappes',
|
||||
'journey.studio.stations': 'Onderweg',
|
||||
'journey.studio.peersHere': 'hier',
|
||||
'journey.studio.folioAuto': 'Automatisch',
|
||||
'journey.studio.exportLayout': 'Opmaak',
|
||||
|
||||
@@ -312,7 +312,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Układ automatyczny',
|
||||
'journey.studio.export': 'Eksportuj',
|
||||
'journey.studio.day': 'DZIEŃ {day}',
|
||||
'journey.studio.stations': 'Etapy',
|
||||
'journey.studio.stations': 'Po drodze',
|
||||
'journey.studio.peersHere': 'tutaj',
|
||||
'journey.studio.folioAuto': 'Automatycznie',
|
||||
'journey.studio.exportLayout': 'Układ',
|
||||
|
||||
@@ -312,7 +312,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Автомакет',
|
||||
'journey.studio.export': 'Экспорт',
|
||||
'journey.studio.day': 'ДЕНЬ {day}',
|
||||
'journey.studio.stations': 'Остановки',
|
||||
'journey.studio.stations': 'По пути',
|
||||
'journey.studio.peersHere': 'здесь',
|
||||
'journey.studio.folioAuto': 'Автоматически',
|
||||
'journey.studio.exportLayout': 'Макет',
|
||||
|
||||
@@ -304,7 +304,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Automatické rozloženie',
|
||||
'journey.studio.export': 'Exportovať',
|
||||
'journey.studio.day': 'DEŇ {day}',
|
||||
'journey.studio.stations': 'Zastávky',
|
||||
'journey.studio.stations': 'Cestou',
|
||||
'journey.studio.peersHere': 'tu',
|
||||
'journey.studio.folioAuto': 'Automaticky',
|
||||
'journey.studio.exportLayout': 'Rozloženie',
|
||||
|
||||
@@ -298,7 +298,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Automatisk layout',
|
||||
'journey.studio.export': 'Exportera',
|
||||
'journey.studio.day': 'DAG {day}',
|
||||
'journey.studio.stations': 'Etapper',
|
||||
'journey.studio.stations': 'Längs vägen',
|
||||
'journey.studio.peersHere': 'här',
|
||||
'journey.studio.folioAuto': 'Automatiskt',
|
||||
'journey.studio.exportLayout': 'Layout', // same-as-en
|
||||
|
||||
@@ -287,7 +287,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'เค้าโครงอัตโนมัติ',
|
||||
'journey.studio.export': 'ส่งออก',
|
||||
'journey.studio.day': 'วันที่ {day}',
|
||||
'journey.studio.stations': 'สถานี',
|
||||
'journey.studio.stations': 'ระหว่างทาง',
|
||||
'journey.studio.peersHere': 'ที่นี่',
|
||||
'journey.studio.folioAuto': 'อัตโนมัติ',
|
||||
'journey.studio.exportLayout': 'เค้าโครง',
|
||||
|
||||
@@ -297,7 +297,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Otomatik yerleşim',
|
||||
'journey.studio.export': 'Dışa aktar',
|
||||
'journey.studio.day': '{day}. GÜN',
|
||||
'journey.studio.stations': 'Duraklar',
|
||||
'journey.studio.stations': 'Yol boyunca',
|
||||
'journey.studio.peersHere': 'burada',
|
||||
'journey.studio.folioAuto': 'Otomatik',
|
||||
'journey.studio.exportLayout': 'Yerleşim',
|
||||
|
||||
@@ -313,7 +313,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Автомакет',
|
||||
'journey.studio.export': 'Експорт',
|
||||
'journey.studio.day': 'ДЕНЬ {day}',
|
||||
'journey.studio.stations': 'Зупинки',
|
||||
'journey.studio.stations': 'Дорогою',
|
||||
'journey.studio.peersHere': 'тут',
|
||||
'journey.studio.folioAuto': 'Автоматично',
|
||||
'journey.studio.exportLayout': 'Макет',
|
||||
|
||||
@@ -292,7 +292,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': 'Bố cục tự động',
|
||||
'journey.studio.export': 'Xuất',
|
||||
'journey.studio.day': 'NGÀY {day}',
|
||||
'journey.studio.stations': 'Chặng dừng',
|
||||
'journey.studio.stations': 'Dọc đường',
|
||||
'journey.studio.peersHere': 'ở đây',
|
||||
'journey.studio.folioAuto': 'Tự động',
|
||||
'journey.studio.exportLayout': 'Bố cục',
|
||||
|
||||
@@ -285,7 +285,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': '自動排版',
|
||||
'journey.studio.export': '匯出',
|
||||
'journey.studio.day': '第{day}天',
|
||||
'journey.studio.stations': '途經地',
|
||||
'journey.studio.stations': '沿途',
|
||||
'journey.studio.peersHere': '在線',
|
||||
'journey.studio.folioAuto': '自動',
|
||||
'journey.studio.exportLayout': '版面',
|
||||
|
||||
@@ -285,7 +285,7 @@ const journey: TranslationStrings = {
|
||||
'journey.studio.autoLayout': '自动排版',
|
||||
'journey.studio.export': '导出',
|
||||
'journey.studio.day': '第{day}天',
|
||||
'journey.studio.stations': '途经地',
|
||||
'journey.studio.stations': '沿途',
|
||||
'journey.studio.peersHere': '在线',
|
||||
'journey.studio.folioAuto': '自动',
|
||||
'journey.studio.exportLayout': '版式',
|
||||
|
||||
Reference in New Issue
Block a user