Skip to content

Commit

Permalink
Fix observable project import. (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
duckonomy authored Jun 8, 2021
1 parent 3ca7e24 commit 71a665f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions geoapi/services/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from sqlalchemy.sql import select, text
from sqlalchemy.exc import IntegrityError
from geoapi.services.users import UserService
from geoapi.services.notifications import NotificationsService
from geoapi.utils.agave import AgaveUtils, get_system_users
from geoapi.utils.assets import get_project_asset_dir
from geoapi.tasks.external_data import import_from_agave, delete_agave_file
Expand Down Expand Up @@ -81,14 +82,17 @@ def createRapidProject(data: dict, user: User) -> Project:
raise ObservableProjectAlreadyExists("'{}' project already exists".format(name))
import_from_agave.apply_async(args=[obs.project.tenant_id, user.id, obs.system_id, obs.path, obs.project_id])

ProjectsService.export(user,
{'system_id': systemId,
'path': folder_name,
'link': True,
'file_name': ''
},
True,
proj.id)
try:
ProjectsService.export(user,
{'system_id': systemId,
'path': path,
'link': True,
'file_name': ''
},
True,
proj.id)
except:
NotificationsService.create(user, "error", "Failed to export file to {}{}.".format(systemId, path))

return proj

Expand Down Expand Up @@ -121,10 +125,6 @@ def export(user: User,

file_name = '{}.{}'.format(file_prefix, 'hazmapper')

# if 'project' not in data['system_id'] and path == '/':
if ('project' not in data['system_id'] and path == '/') or observable:
path = "/{}/{}".format(user.username, path)

proj.system_path = path
proj.system_file = file_name
proj.system_id = data['system_id']
Expand Down

0 comments on commit 71a665f

Please sign in to comment.