From ebfeee414acc0f59090fc86eaf2d631b7a3f0790 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 19 Oct 2021 05:29:46 +0000 Subject: Fixed some errors/logic for search results related to how the name/display name was being set --- wqflask/wqflask/search_results.py | 26 +++++++++++------------ wqflask/wqflask/templates/search_result_page.html | 12 ++++++++++- 2 files changed, 24 insertions(+), 14 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/search_results.py b/wqflask/wqflask/search_results.py index f8ecd178..dcc8021a 100644 --- a/wqflask/wqflask/search_results.py +++ b/wqflask/wqflask/search_results.py @@ -112,22 +112,11 @@ class SearchResultPage: trait_dict = {} trait_dict['index'] = index + 1 - trait_dict['name'] = result[2] - - #ZS: Check permissions on a trait-by-trait basis for phenotype traits - if self.dataset.type == "Publish": - permissions = check_resource_availability(self.dataset, trait_dict['name']) - if "view" not in permissions['data']: - continue - - trait_dict['display_name'] = result[0] - if self.dataset.type == "Publish": - if result[10]: - trait_dict['display_name'] = str(result[10]) + "_" + str(result[0]) trait_dict['dataset'] = self.dataset.name - trait_dict['hmac'] = hmac.data_hmac('{}:{}'.format(trait_dict['name'], trait_dict['dataset'])) if self.dataset.type == "ProbeSet": + trait_dict['display_name'] = result[2] + trait_dict['hmac'] = hmac.data_hmac('{}:{}'.format(trait_dict['display_name'], trait_dict['dataset'])) trait_dict['symbol'] = "N/A" if result[3] is None else result[3].strip() description_text = "N/A" if result[4] is None or str(result[4]) == "" else trait_dict['symbol'] @@ -144,10 +133,21 @@ class SearchResultPage: trait_dict['lod_score'] = "N/A" if result[9] is None or result[9] == "" else f"{float(result[9]) / 4.61:.1f}" trait_dict['lrs_location'] = "N/A" if result[13] is None or result[13] == "" or result[14] is None else f"Chr{result[13]}: {float(result[14]):.6f}" elif self.dataset.type == "Geno": + trait_dict['display_name'] = str(result[0]) + trait_dict['hmac'] = hmac.data_hmac('{}:{}'.format(trait_dict['display_name'], trait_dict['dataset'])) trait_dict['location'] = "N/A" if (result[4] != "NULL" and result[4] != "") and (result[5] != 0): trait_dict['location'] = f"Chr{result[4]}: {float(result[5]):.6f}" elif self.dataset.type == "Publish": + # Check permissions on a trait-by-trait basis for phenotype traits + trait_dict['name'] = trait_dict['display_name'] = str(result[0]) + trait_dict['hmac'] = hmac.data_hmac('{}:{}'.format(trait_dict['name'], trait_dict['dataset'])) + permissions = check_resource_availability(self.dataset, trait_dict['display_name']) + if "view" not in permissions['data']: + continue + + if result[10]: + trait_dict['display_name'] = str(result[10]) + "_" + str(result[0]) trait_dict['description'] = "N/A" trait_dict['pubmed_id'] = "N/A" trait_dict['pubmed_link'] = "N/A" diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 5922ac75..95842316 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -206,7 +206,7 @@ 'width': "{{ max_widths.display_name * 8 }}px", 'targets': 2, 'render': function(data, type, row, meta) { - return '' + data.display_name + '' + return '' + data.display_name + '' } }, { @@ -361,6 +361,16 @@ 'targets': 9, 'orderSequence': [ "desc", "asc"] }{% elif dataset.type == 'Geno' %}, + { + 'title': "Record", + 'type': "natural-minus-na", + 'width': "{{ max_widths.display_name * 9 }}px", + 'data': null, + 'targets': 2, + 'render': function(data, type, row, meta) { + return '' + data.display_name + '' + } + }, { 'title': "
Location
", 'type': "natural-minus-na", -- cgit v1.2.3