updates trail panel view

This commit is contained in:
Christian Beutel
2025-01-27 19:38:38 +01:00
parent 5922034183
commit e837b6e04b
25 changed files with 427 additions and 182 deletions

View File

@@ -16,6 +16,7 @@ export async function GET(event: RequestEvent) {
t.expand = {} as any
}
t.expand!.author = await pb.collection("users_anonymous").getOne(t.author);
t.expand?.waypoints?.sort((a, b) => (a.distance_from_start ?? 0) - (b.distance_from_start ?? 0))
}
return json(r)
} catch (e: any) {

View File

@@ -27,6 +27,9 @@ export async function GET(event: RequestEvent) {
log.expand!.author = await pb.collection("users_anonymous").getOne(log.author);
}
}
// sort waypoints by distance
r.expand?.waypoints?.sort((a, b) => (a.distance_from_start ?? 0) - (b.distance_from_start ?? 0))
return json(r)
} catch (e: any) {
throw handleError(e)