added branch

This commit is contained in:
2025-02-18 18:24:04 +01:00
parent 444c47e3a4
commit 357edf3000
7 changed files with 10140 additions and 15 deletions

View File

@@ -1,9 +1,10 @@
"""Main app for backend api"""
import json
import logging
import time
from contextlib import asynccontextmanager
from fastapi import FastAPI, HTTPException, BackgroundTasks, Query
from fastapi.encoders import jsonable_encoder
from .logging_config import configure_logging
from .structs.landmark import Landmark, Toilets
@@ -96,6 +97,11 @@ def new_trip(preferences: Preferences,
if len(landmarks) == 0 :
raise HTTPException(status_code=500, detail="No landmarks were found.")
# store landmarks in json file for debug
landmarks_list = [jsonable_encoder(item) for item in landmarks]
with open('landmarks.json', 'w+') as file:
json.dump(landmarks_list, file, indent=4)
# insert start and finish to the landmarks list
landmarks_short.insert(0, start_landmark)
landmarks_short.append(end_landmark)