Open
Conversation
AvtoBBus
reviewed
Apr 9, 2026
| CORS(app) | ||
|
|
||
| API_KEY = os.getenv('YANDEX_API_KEY') | ||
| FLASK_DEBUG = os.getenv('FLASK_DEBUG', 'True') == 'True' |
Comment on lines
+91
to
+98
| popular_stations = [ | ||
| {'name': 'Москва (Киевский вокзал)', 'code': 's9603402'}, | ||
| {'name': 'Санкт-Петербург (Витебский)', 'code': 's9603551'}, | ||
| {'name': 'Москва (Казанский вокзал)', 'code': 's9603404'}, | ||
| {'name': 'Москва (Ярославский вокзал)', 'code': 's9603408'}, | ||
| {'name': 'Москва (Павелецкий вокзал)', 'code': 's9603405'}, | ||
| ] | ||
| return jsonify(popular_stations) |
Collaborator
There was a problem hiding this comment.
В целом нормально, так как написание алгоритма отбора популярных остановок явно сильно выходит за рамки лабы
AvtoBBus
requested changes
Apr 9, 2026
Comment on lines
+276
to
+281
| ymaps.ready(() => { | ||
| map = new ymaps.Map('map', { | ||
| center: [55.751574, 37.573856], | ||
| zoom: 10, | ||
| controls: ['zoomControl', 'fullscreenControl', 'geolocationControl'] | ||
| }); |
Collaborator
Comment on lines
+336
to
+353
| hintContent: stationName, | ||
| balloonContent: `<div class="station-balloon"><strong>${stationName}</strong><br><small>Расстояние: ${distance} км</small><br><button id="${buttonId}" style="margin-top:8px; background:#1a1a2e; color:white; border:none; padding:5px 10px; border-radius:6px; cursor:pointer;">Выбрать станцию</button></div>` | ||
| }, { preset: 'islands#blueRailwayIcon' }); | ||
|
|
||
| marker.events.add('balloonopen', function() { | ||
| const button = document.getElementById(buttonId); | ||
| if (button) button.onclick = () => { selectStationFromMap(stationCode, stationName); marker.balloon.close(); }; | ||
| }); | ||
|
|
||
| map.geoObjects.add(marker); | ||
| mapMarkers.push(marker); | ||
| } | ||
|
|
||
| const stationItem = $(`<div class="nearby-station-item" data-code="${stationCode}" data-name="${stationName}"><i class="fas fa-train"></i><div class="station-info"><strong>${stationName}</strong><span class="distance">${distance} км</span>${city ? `<span class="city">${city}</span>` : ''}</div><button class="select-station-btn">Выбрать</button></div>`); | ||
| stationItem.find('.select-station-btn').click(() => selectStationFromMap(stationCode, stationName)); | ||
| stationItem.click(() => selectStationFromMap(stationCode, stationName)); | ||
| $('#nearby-stations-list').append(stationItem); | ||
| }); |
Collaborator
There was a problem hiding this comment.
Во-первых, мне больно глаза, не нужно html в одну строку;
Во-вторых, здесь и в остальных местах, где идёт генерация верстки, вынесите в отдельный файл
Comment on lines
+206
to
+221
| function toggleFavorite(name) { | ||
| const idx = favorites.indexOf(name); | ||
| if (idx === -1) { | ||
| favorites.push(name); | ||
| showMessage(`❤️ ${name} добавлена в избранное`); | ||
| } else { | ||
| favorites.splice(idx, 1); | ||
| showMessage(`💔 ${name} удалена из избранного`); | ||
| } | ||
| localStorage.setItem('railway_favorites', JSON.stringify(favorites)); | ||
| renderFavorites(); | ||
| } | ||
|
|
||
| function isFavorite(name) { | ||
| return favorites.includes(name); | ||
| } |
Collaborator
There was a problem hiding this comment.
Везде где идёт взаимодействие и работа с любимыми остановками и localStorage, во-первых проверяйте, что он доступен, а во-вторых, вынесите функции в отдельный файл
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Веб-приложение для просмотра расписания пригородных поездов с использованием API Яндекс.Расписаний.
Backend: Flask, yaschedule, requests
Frontend: HTML5, CSS3, jQuery, Яндекс.Карты API
API: Яндекс.Расписания
Как запустить проект:
cd backend
pip install -r requirements.txt
python server.py
http://localhost:5000