-
-
Notifications
You must be signed in to change notification settings - Fork 29
feat: Smart/Origin parcours 3 itinévert #2100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
(cherry picked from commit bc12f10)
…hen saving (issue 1789)
… is not the same as the day in parameters
…nctions for Itinevert routes
…cess waypoint of the route
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello !
Merci pour le travail !
Quelques petites remarques concernant quelques commentaire en français qui traînent, des noqa et codes HTTP incorrect
Ma plus grosse interrogation concerne la réplication des filtres elastics, destinés à évoluer pour faire des recherches améliorées. Comment cela sera-t-il compatible avec ce système ?
Est-ce possible de rajouter des tests ? ☺
| api_key = os.getenv("NAVITIA_API_KEY") | ||
| max_duration = int(max_distance_waypoint_to_stoparea / walking_speed) | ||
|
|
||
| # Augmenter le nombre d'arrêts récupérés pour avoir plus de choix (comme dans le bash) # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Les commentaires devraient être en anglais, comme pour le reste du code
|
|
||
| if "places_nearby" not in places_data or not places_data["places_nearby"]: | ||
| log.warning(f"No Navitia stops found for the waypoint {waypoint_id}") | ||
| log.warning(f"No Navitia stops found for the waypoint {waypoint_id}; deleting previously registered stops") # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Préférer l'utilisation de %s ou .format pour une meilleure homogénéité du code (les f-string ne sont utilisés nulle part ailleurs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Est-ce vraiment un warning ? C'est plutôt un comportement normal qui ne nécessite pas d'attention particulière ? (dans ce cas, préférer un .info)
| delete_waypoint_stopareas(connection, waypoint_id) | ||
| return | ||
|
|
||
| # --- NOUVEAU : Filtrage par diversité de transport (comme dans bash) --- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
traduire en anglias
| }, | ||
| ) | ||
|
|
||
| log.warning(f"Selected {selected_count} stops out of {len(places_data['places_nearby'])} for waypoint {waypoint_id}") # noqa: E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem: format + # noqa: E501
|
|
||
| log.warning(f"Selected {selected_count} stops out of {len(places_data['places_nearby'])} for waypoint {waypoint_id}") # noqa: E501 | ||
|
|
||
| log.warning("Deleting previously registered stops") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem -> log.info
| response = {} | ||
|
|
||
| if (source_coverage): | ||
| # Appel à l'API Navitia Journey with coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
| # no_origin -> public transport not reachable from origin | ||
| # these do not count as proper errors, | ||
| # more like the wp is just not reachable | ||
| raise HTTPInternalServerError(response.json()['error']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem qu'au dessus ; mettre la gestion des erreurs dans une fonction commune ?
| elif not response.ok: | ||
| raise HTTPInternalServerError(f'Navitia API error: {response.status_code}') # noqa: E501 | ||
| else: | ||
| # Retour des données JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commentaire inutile, et en français
| 'Timeout when calling the Navitia API') | ||
| except requests.exceptions.RequestException as e: | ||
| raise HTTPInternalServerError(f'{str(e)}') | ||
| except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
|
|
||
| try: | ||
| # Récupération de la clé API depuis les variables d'environnement | ||
| api_key = os.getenv('NAVITIA_API_KEY') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est le seul endroit du code où on récupère un paramètre comme ça ; pourquoi ne pas avoir fait comme ailleurs ?
No description provided.