From b652c5bc4c1c174d451a85956ca9f0d2d149c28e Mon Sep 17 00:00:00 2001 From: Stream Date: Sat, 25 Apr 2026 01:40:01 +0300 Subject: [PATCH] auto-sync: 2026-04-25 01:40:01 --- tasks/flightradar24/frontend/main.py | 3 +- .../frontend/static/schedule.html | 5 +- .../flightradar24/frontend/static/schedule.js | 38 +++++------ .../reports/dev-2026-04-25-ui-schedule-fix.md | 64 +++++++++++++++++++ 4 files changed, 85 insertions(+), 25 deletions(-) create mode 100644 tasks/flightradar24/reports/dev-2026-04-25-ui-schedule-fix.md diff --git a/tasks/flightradar24/frontend/main.py b/tasks/flightradar24/frontend/main.py index 6c0487e..0789b07 100644 --- a/tasks/flightradar24/frontend/main.py +++ b/tasks/flightradar24/frontend/main.py @@ -551,7 +551,8 @@ def schedule_data(): "track_points": r.get("track_points"), "sched_source": r.get("sched_source"), # Эффективная длительность: FA > schedule - "duration_eff": r.get("fa_flight_time") or r.get("duration_min"), + # fa_flight_time — секунды (FR24), duration_min — минуты (Яндекс) + "duration_eff": (lambda fa_ft: (int(fa_ft) // 60 if fa_ft else None) or r.get("duration_min"))(r.get("fa_flight_time")), # Маршрут из FR24 (IATA коды → города) "fa_origin_iata": r.get("fa_orig_iata"), "fa_dest_iata": r.get("fa_dest_iata"), diff --git a/tasks/flightradar24/frontend/static/schedule.html b/tasks/flightradar24/frontend/static/schedule.html index ea93973..5d5b4de 100644 --- a/tasks/flightradar24/frontend/static/schedule.html +++ b/tasks/flightradar24/frontend/static/schedule.html @@ -330,8 +330,7 @@ Маршрут Аэропорт По расп. - Взлёт факт - Посадка факт + Фактическое Длит. ВПП ВС @@ -339,7 +338,7 @@ - Загрузка… + Загрузка… diff --git a/tasks/flightradar24/frontend/static/schedule.js b/tasks/flightradar24/frontend/static/schedule.js index c146b21..6cbfdfe 100644 --- a/tasks/flightradar24/frontend/static/schedule.js +++ b/tasks/flightradar24/frontend/static/schedule.js @@ -107,7 +107,7 @@ async function loadData() { function renderTable(flights) { const tbody = document.getElementById("table-body"); if (!flights.length) { - tbody.innerHTML = `Нет данных по выбранным фильтрам`; + tbody.innerHTML = `Нет данных по выбранным фильтрам`; return; } @@ -140,23 +140,20 @@ function renderTable(flights) { // 7. По расписанию (MSK) const sched = fmtTime(f.scheduled_at); - // 8. Взлёт факт + задержка - const actTakeoffCell = f.actual_takeoff - ? `${fmtTime(f.actual_takeoff)} ${delayCell(f.delay_takeoff_min)}` + // 8. Фактическое время: вылет → actual_takeoff, прилёт → actual_landed + const actTime = f.direction === "departure" ? f.actual_takeoff : f.actual_landed; + const actDelay = f.direction === "departure" ? f.delay_takeoff_min : f.delay_landed_min; + const actCell = actTime + ? `${fmtTime(actTime)} ${delayCell(actDelay)}` : "—"; - // 9. Посадка факт - const actLandedCell = f.actual_landed - ? `${fmtTime(f.actual_landed)} ${delayCell(f.delay_landed_min)}` - : "—"; - - // 10. Длительность (FA flight_time > schedule duration_min) + // 9. Длительность (FA flight_time > schedule duration_min) const durationCell = fmtDuration(f.duration_eff); - // 11. ВПП - const runway = (f.runway_takeoff || f.runway_landed) - ? `${f.runway_takeoff || "?"}→${f.runway_landed || "?"}` - : "—"; + // 11. ВПП (по направлению рейса) + const runway = f.direction === "departure" + ? (f.runway_takeoff || "—") + : (f.runway_landed || "—"); // 12. Тип ВС const acType = f.aircraft_type ? esc(f.aircraft_type) : "—"; @@ -182,8 +179,7 @@ function renderTable(flights) { ${esc(route)} ${airport} ${sched} - ${actTakeoffCell} - ${actLandedCell} + ${actCell} ${durationCell} ${runway} ${acType} @@ -229,9 +225,9 @@ function renderCards(flights) { f.registration ? `${esc(f.registration)}` : "", ].filter(Boolean).join(" / "); - const runway = (f.runway_takeoff || f.runway_landed) - ? `${f.runway_takeoff || "?"}→${f.runway_landed || "?"}` - : "—"; + const runway = f.direction === "departure" + ? (f.runway_takeoff || "—") + : (f.runway_landed || "—"); return `
@@ -353,7 +349,7 @@ function esc(s) { function setLoading(on) { if (on) { document.getElementById("table-body").innerHTML = - `Загрузка…`; + `Загрузка…`; document.getElementById("cards-container").innerHTML = `
Загрузка…
`; } @@ -361,7 +357,7 @@ function setLoading(on) { function showError(msg) { document.getElementById("table-body").innerHTML = - `Ошибка: ${esc(msg)}`; + `Ошибка: ${esc(msg)}`; document.getElementById("cards-container").innerHTML = `
Ошибка: ${esc(msg)}
`; } diff --git a/tasks/flightradar24/reports/dev-2026-04-25-ui-schedule-fix.md b/tasks/flightradar24/reports/dev-2026-04-25-ui-schedule-fix.md new file mode 100644 index 0000000..6af1509 --- /dev/null +++ b/tasks/flightradar24/reports/dev-2026-04-25-ui-schedule-fix.md @@ -0,0 +1,64 @@ +# UI Schedule Fix — 2026-04-25 + +## Задача +Три правки в UI расписания (schedule.js, schedule.html, main.py). + +## Правки + +### 1. duration_eff — единицы (main.py, строка 554–555) +**Проблема:** `fa_flight_time` из FR24 — секунды, `duration_min` из Яндекса — минуты. Смешивались без конвертации. + +**Было:** +```python +"duration_eff": r.get("fa_flight_time") or r.get("duration_min"), +``` + +**Стало:** +```python +# fa_flight_time — секунды (FR24), duration_min — минуты (Яндекс) +"duration_eff": (lambda fa_ft: (int(fa_ft) // 60 if fa_ft else None) or r.get("duration_min"))(r.get("fa_flight_time")), +``` + +--- + +### 2. Колонки фактического времени (schedule.js + schedule.html) +**Проблема:** Было 2 колонки «Взлёт факт» и «Посадка факт», показывались обе независимо от направления рейса. + +**Стало:** 1 колонка «Фактическое» — для вылетов `actual_takeoff`, для прилётов `actual_landed`. + +**schedule.js (renderTable):** +```js +const actTime = f.direction === "departure" ? f.actual_takeoff : f.actual_landed; +const actDelay = f.direction === "departure" ? f.delay_takeoff_min : f.delay_landed_min; +const actCell = actTime + ? `${fmtTime(actTime)} ${delayCell(actDelay)}` + : "—"; +``` + +**schedule.html:** Убрана колонка «Посадка факт», «Взлёт факт» → «Фактическое». + +**Обновлено:** все `colspan="13"` → `colspan="12"` (schedule.js × 3, schedule.html × 1). + +--- + +### 3. ВПП по направлению рейса (schedule.js) +**Проблема:** Показывалось `runway_takeoff→runway_landed` вне зависимости от типа рейса. + +**Стало:** только один runway по направлению. + +**renderTable и renderCards:** +```js +const runway = f.direction === "departure" + ? (f.runway_takeoff || "—") + : (f.runway_landed || "—"); +``` + +--- + +## Деплой +- Файлы загружены на VM: `/home/fr24/projects/fr24/frontend/` +- `docker cp` в контейнер `fr24-api` +- `docker restart fr24-api` — успешно + +## Статус +✅ Все три правки применены и задеплоены.