Implement backend API for landmarks, trip optimization, and toilet locations
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m49s
Run linting on the backend code / Build (pull_request) Successful in 30s
Run testing on the backend code / Build (pull_request) Failing after 45s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 32s

- Added landmarks_router.py to handle landmark retrieval based on user preferences and location.
- Implemented optimization_router.py for trip optimization, including handling preferences and landmarks.
- Created toilets_router.py to fetch toilet locations within a specified radius from a given location.
- Enhanced error handling and logging across all new endpoints.
- Generated a comprehensive report.html for test results and environment details.
This commit is contained in:
2025-07-13 17:43:24 +02:00
parent 54bc9028ad
commit b0f9d31ee2
15 changed files with 1235 additions and 217 deletions

View File

@@ -1,24 +0,0 @@
"""Helper function to return only the major landmarks from a large list."""
from ..structs.landmark import Landmark
def take_most_important(
landmarks: list[Landmark],
n_important: int
) -> list[Landmark]:
"""
Given a list of landmarks, return the most important landmarks based on their attractiveness.
Args:
landmarks (list[Landmark]): List of landmarks that needs to be truncated
n_important (int): Number of most important landmarks to return
Returns:
list[Landmark]: List of the n_important most important landmarks
"""
if n_important == 0 :
raise ValueError('Number of landmarks to keep cannot be zero.')
# Sort landmarks by attractiveness (descending)
sorted_landmarks = sorted(landmarks, key=lambda x: x.attractiveness, reverse=True)
return sorted_landmarks[:n_important]