auto-sync: 2026-05-04 11:40:01
This commit is contained in:
@@ -497,6 +497,33 @@ async def post_route(req: RouteRequest):
|
||||
except Exception as e:
|
||||
raise HTTPException(503, f"OSRM недоступен: {e}")
|
||||
|
||||
# OSRM возвращает TooBig когда маршрут слишком длинный для N альтернатив
|
||||
if data.get("code") == "TooBig":
|
||||
# Пробуем с меньшим числом альтернатив
|
||||
url_retry3 = (
|
||||
f"{OSRM_URL}/route/v1/driving/{coords_str}"
|
||||
f"?alternatives=3&overview=full&geometries=geojson&annotations=false"
|
||||
)
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=30) as client:
|
||||
resp = await client.get(url_retry3)
|
||||
data = resp.json()
|
||||
except Exception as e:
|
||||
raise HTTPException(503, f"OSRM недоступен: {e}")
|
||||
|
||||
if data.get("code") == "TooBig":
|
||||
# Всё ещё TooBig — пробуем совсем без альтернатив
|
||||
url_retry1 = (
|
||||
f"{OSRM_URL}/route/v1/driving/{coords_str}"
|
||||
f"?overview=full&geometries=geojson&alternatives=false"
|
||||
)
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=30) as client:
|
||||
resp = await client.get(url_retry1)
|
||||
data = resp.json()
|
||||
except Exception as e:
|
||||
raise HTTPException(503, f"OSRM недоступен: {e}")
|
||||
|
||||
if data.get("code") != "Ok" or not data.get("routes"):
|
||||
raise HTTPException(404, "Маршрут не найден")
|
||||
|
||||
|
||||
1
tasks/enduro-trails/prototype/static/app.js
vendored
1
tasks/enduro-trails/prototype/static/app.js
vendored
@@ -7,6 +7,7 @@ function formatDuration(seconds) {
|
||||
const hours = Math.floor((totalMin % 1440) / 60);
|
||||
const mins = totalMin % 60;
|
||||
if (days > 0) {
|
||||
if (hours === 0 && mins === 0) return `${days} дн`;
|
||||
if (mins === 0) return `${days} дн ${hours} ч`;
|
||||
return `${days} дн ${hours} ч ${mins} мин`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user