added branch
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user