Trail Edit / Waypoints from photos: prevent creating different waypoints for near-by locations (#457)
* trail edit / waypoints from photos: prevent creating different waypoints for near-by locations * remove not necessary imports * remove changes from gitignore * patch gitignore * waypoint merge radius as category property * change datamodel for merge radius (use more generic settings field for future implementations) * fix npm run check issues * several improvements/fixes * fix * move geo cluster code to db * fix compile issue * fix docker issue * merge with existing waypoints --------- Co-authored-by: Christian Beutel <> Co-authored-by: Flomp <Flomp@users.noreply.github.com>
This commit is contained in:
@@ -221,17 +221,37 @@ export async function trails_create(trail: Trail, photos: File[], gpx: File | Bl
|
||||
|
||||
let model: Trail = await r.json();
|
||||
|
||||
const createdSummitLogs: SummitLog[] = [];
|
||||
for (const summitLog of trail.expand?.summit_logs_via_trail ?? []) {
|
||||
summitLog.trail = model.id!;
|
||||
await summit_logs_create(summitLog, f);
|
||||
createdSummitLogs.push(await summit_logs_create(summitLog, f));
|
||||
}
|
||||
|
||||
const createdWaypoints: Waypoint[] = [];
|
||||
for (const wp of trail.expand?.waypoints_via_trail ?? []) {
|
||||
wp.trail = model.id!;
|
||||
await waypoints_create({
|
||||
createdWaypoints.push(await waypoints_create({
|
||||
...wp,
|
||||
marker: undefined,
|
||||
}, f, user);
|
||||
}, f, user));
|
||||
}
|
||||
|
||||
if (!model.expand) {
|
||||
model.expand = {};
|
||||
}
|
||||
|
||||
if (createdSummitLogs.length) {
|
||||
model.expand.summit_logs_via_trail = [
|
||||
...(model.expand.summit_logs_via_trail ?? []),
|
||||
...createdSummitLogs,
|
||||
];
|
||||
}
|
||||
|
||||
if (createdWaypoints.length) {
|
||||
model.expand.waypoints_via_trail = [
|
||||
...(model.expand.waypoints_via_trail ?? []),
|
||||
...createdWaypoints,
|
||||
];
|
||||
}
|
||||
|
||||
return model;
|
||||
|
||||
Reference in New Issue
Block a user