Skip to content

Commit

Permalink
Merge pull request #154 from sennetconsortium/maxsibilla/has-data-fix
Browse files Browse the repository at this point in the history
Maxsibilla/has data fix
  • Loading branch information
maxsibilla authored Oct 2, 2023
2 parents 73f7faf + fffd86b commit aecc234
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/lib/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,17 @@ def ln_err(error: str, row: int = None, column: str = None):
}


def files_exist(uuid, data_access_level):
def files_exist(uuid, data_access_level, group_name):
if not uuid or not data_access_level:
return False
if data_access_level == "public":
absolute_path = commons_file_helper.ensureTrailingSlashURL(current_app.config['GLOBUS_PUBLIC_ENDPOINT_FILEPATH'])
# consortium access
elif data_access_level == 'consortium':
absolute_path = commons_file_helper.ensureTrailingSlashURL(current_app.config['GLOBUS_CONSORTIUM_ENDPOINT_FILEPATH'])
absolute_path = commons_file_helper.ensureTrailingSlashURL(current_app.config['GLOBUS_CONSORTIUM_ENDPOINT_FILEPATH'] + '/' + group_name)
# protected access
elif data_access_level == 'protected':
absolute_path = commons_file_helper.ensureTrailingSlashURL(current_app.config['GLOBUS_PROTECTED_ENDPOINT_FILEPATH'])

absolute_path = commons_file_helper.ensureTrailingSlashURL(current_app.config['GLOBUS_PROTECTED_ENDPOINT_FILEPATH'] + '/' + group_name)
file_path = absolute_path + uuid
if os.path.exists(file_path) and os.path.isdir(file_path) and os.listdir(file_path):
return True
Expand Down
2 changes: 1 addition & 1 deletion src/routes/entity_CRUD/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def dataset_data_status():
dataset['is_primary'] = "true"
else:
dataset['is_primary'] = "false"
has_data = files_exist(dataset.get('uuid'), dataset.get('data_access_level'))
has_data = files_exist(dataset.get('uuid'), dataset.get('data_access_level'), dataset.get('group_name'))
dataset['has_data'] = has_data

for prop in dataset:
Expand Down

0 comments on commit aecc234

Please sign in to comment.