From dd6c1d2b42a12cd88bf3469be1d876219b075ef8 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Sun, 31 May 2020 18:16:42 -0600 Subject: [PATCH] Renaming approval files --- crc/models/approval.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/crc/models/approval.py b/crc/models/approval.py index 497a6bbf..1f7eed38 100644 --- a/crc/models/approval.py +++ b/crc/models/approval.py @@ -68,10 +68,10 @@ class Approval(object): if model.study: instance.title = model.study.title + principal_investigator_id = model.study.primary_investigator_id instance.approver = {} try: ldap_service = LdapService() - principal_investigator_id = model.study.primary_investigator_id user_info = ldap_service.user_info(principal_investigator_id) except (ApiError, LDAPSocketOpenError) as exception: user_info = None @@ -97,17 +97,13 @@ class Approval(object): associated_file = {} associated_file['id'] = approval_file.file_data.file_model.id if extra_info: - categories = [extra_info['category1'], extra_info['category2'], extra_info['category3']] - # Clear empty values - categories = list(filter(lambda x: x != '' and x != 'NULL', categories)) - # Replace spaces with underscores and lowercase - categories = ['_'.join(category.split()) for category in categories] - categories = '_'.join(categories).lower() - associated_file['name'] = '_'.join((categories, approval_file.file_data.file_model.name)) - associated_file['description'] = extra_info + irb_doc_code = approval_file.file_data.file_model.irb_doc_code + associated_file['name'] = '_'.join((irb_doc_code, approval_file.file_data.file_model.name)) + associated_file['description'] = extra_info['description'] else: associated_file['name'] = approval_file.file_data.file_model.name associated_file['description'] = 'No description available' + associated_file['name'] = '(' + principal_investigator_id + ')' + associated_file['name'] associated_file['content_type'] = approval_file.file_data.file_model.content_type instance.associated_files.append(associated_file)