постоение маршрута
Gitea Actions Demo / build_and_push (push) Failing after 25s Details

This commit is contained in:
artem 2026-09-18 20:57:34 +03:00
parent 746e2c9a3c
commit d17cd207d8
2 changed files with 38 additions and 8 deletions

View File

@ -2,11 +2,20 @@
## Task State
- task_id: TASK-LINK1
- task_id: TASK-ROUTE-FIX
- status: success
- parent_task: —
- summary: **FIX: секция «Ссылки на описание» в components/WorkoutItem.vue — кнопка «Добавить» видна на публичной странице (isPrivate=false), но не работает (модалка скрыта v-if="isPrivate"). Правило: нет ссылки + нет прав → секция полностью скрыта.**
- next task: after Coder returns — review and close.
- summary: **FIX + FEATURE: Route.vue — багфикс GPX-генератора (for...in, дубликаты, фейковый ele) + snap to road через GraphHopper Cloud API.**
- next task: —
## ✅ CODER SUCCESS REPORT — TASK-ROUTE-FIX
- Изменены файлы:
- `src/pages/routes/Route.vue`: `toGPX()` (var→const, for...in→index loop, ele fix), `handleMapClick` (async, 5m filter + snapToRoad), template onClick
- `src/services/roadSnap.ts` (НОВЫЙ): `snapToRoad(lon, lat)` → GraphHopper Cloud API, fallback к исходным координатам
- Поведение: клик рядом с дорогой → точка прилипает (snap); двойной клик < 5м → игнорируется; GraphHopper down → работает как раньше
- `yarn lint`: exit 0
- `yarn build`: exit 0 (vue-tsc --noEmit + vite build)
## TASK-LINK1 — TODO (delegate to Coder)

View File

@ -16,8 +16,7 @@
<yandex-map-default-features-layer />
<yandex-map-listener
:settings="{
onClick: (_: any, e: any) =>
(clickCoordinates = [...clickCoordinates, e.coordinates]),
onClick: (_: any, e: any) => handleMapClick(e.coordinates),
}"
/>
<yandex-map-default-marker
@ -90,6 +89,7 @@
import { ref, shallowRef } from "vue";
import type { LngLat, YMap } from "@yandex/ymaps3-types";
import { snapToRoad } from "../../services/roadSnap";
import {
YandexMap,
YandexMapDefaultSchemeLayer,
@ -108,11 +108,32 @@ const height = `${window.innerHeight}px`;
const map = shallowRef<null | YMap>(null);
const clickCoordinates = ref<LngLat[]>([]);
const SNAP_THRESHOLD_M = 5;
async function handleMapClick(coords: LngLat): Promise<void> {
if (clickCoordinates.value.length > 0) {
const last = clickCoordinates.value[clickCoordinates.value.length - 1];
if (
calculateHaversineDistance(coords[0], coords[1], last[0], last[1]) *
1000 <
SNAP_THRESHOLD_M
) {
return;
}
}
const [snappedLon, snappedLat] = await snapToRoad(coords[0], coords[1]);
clickCoordinates.value = [
...clickCoordinates.value,
[snappedLon, snappedLat],
];
}
const toGPX = () => {
let content = "";
var date = new Date().toISOString();
for (let i in clickCoordinates.value) {
content += `<trkpt lat="${clickCoordinates.value[i][1]}" lon="${clickCoordinates.value[i][0]}"><ele>${i}</ele><time>${date}</time></trkpt>`;
const date = new Date().toISOString();
for (let i = 0; i < clickCoordinates.value.length; i++) {
content += `<trkpt lat="${clickCoordinates.value[i][1]}" lon="${clickCoordinates.value[i][0]}"><ele>0</ele><time>${date}</time></trkpt>`;
}
return `<?xml version="1.0" encoding="UTF-8" standalone="no" ?><gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" creator="cycle-rider.ru.ru" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd"><metadata><name>cycle-rider.ru</name><time>${date}</time></metadata><trk><name>cycle-rider.ru</name><trkseg>${content}</trkseg></trk></gpx>`;
};