Skip to content

Commit

Permalink
fix: set tile_path_instance outside try, ref before assign
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Aug 24, 2023
1 parent 5917566 commit 40b0326
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -2115,26 +2115,26 @@ async def get_project_tiles(
source: str,
background_task_id: uuid.UUID,
):
try:
"""Get the tiles for a project"""

zooms = [12, 13, 14, 15, 16, 17, 18, 19]
source = source
tiles_path_id = uuid.uuid4()
tiles_dir = f"{TILESDIR}/{tiles_path_id}"
base = f"{tiles_dir}/{source}tiles"
outfile = f"{tiles_dir}/{project_id}_{source}tiles.mbtiles"

if not os.path.exists(base):
os.makedirs(base)
"""Get the tiles for a project."""
zooms = [12, 13, 14, 15, 16, 17, 18, 19]
source = source
tiles_path_id = uuid.uuid4()
tiles_dir = f"{TILESDIR}/{tiles_path_id}"
base = f"{tiles_dir}/{source}tiles"
outfile = f"{tiles_dir}/{project_id}_{source}tiles.mbtiles"

if not os.path.exists(base):
os.makedirs(base)

tile_path_instance = db_models.DbTilesPath(
project_id="",
background_task_id=str(background_task_id),
status=1,
tile_source=source,
path=outfile,
)

tile_path_instance = db_models.DbTilesPath(
project_id=project_id,
background_task_id=str(background_task_id),
status=1,
tile_source=source,
path=outfile,
)
try:
db.add(tile_path_instance)
db.commit()

Expand Down

0 comments on commit 40b0326

Please sign in to comment.