aboutsummaryrefslogtreecommitdiff
path: root/gn2
diff options
context:
space:
mode:
authorzsloan2024-07-29 20:59:31 +0000
committerzsloan2024-07-29 20:59:31 +0000
commit8ce3d96284a3063b19489f73cb23764daec36a71 (patch)
tree4a2bd9be2d20e249cbe24af521a346415175171d /gn2
parent875debdb852557bc8f6c68cbb85f9d9d92449ba0 (diff)
downloadgenenetwork2-8ce3d96284a3063b19489f73cb23764daec36a71.tar.gz
Include trait and dataset name in hmac passed to search results page for non-xapian results
Previously it only had the hmac, which caused adding to a collection to not work for such searches
Diffstat (limited to 'gn2')
-rw-r--r--gn2/wqflask/search_results.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/gn2/wqflask/search_results.py b/gn2/wqflask/search_results.py
index 72baa6e9..cb91abf1 100644
--- a/gn2/wqflask/search_results.py
+++ b/gn2/wqflask/search_results.py
@@ -158,7 +158,7 @@ class SearchResultPage:
trait_dict['dataset'] = self.dataset.name
if self.dataset.type == "ProbeSet":
trait_dict['display_name'] = result[2]
- trait_dict['hmac'] = hmac_creation('{}:{}'.format(trait_dict['display_name'], trait_dict['dataset']))
+ trait_dict['hmac'] = f"{trait_dict['display_name']}:{trait_dict['dataset']}:{hmac_creation('{}:{}'.format(trait_dict['display_name'], trait_dict['dataset']))}"
trait_dict['symbol'] = "N/A" if result[3] is None else result[3].strip()
description_text = ""
if result[4] is not None and str(result[4]) != "":
@@ -178,14 +178,14 @@ class SearchResultPage:
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['hmac'] = f"{trait_dict['display_name']}:{trait_dict['dataset']}:{hmac_creation('{}:{}'.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_creation('{}:{}'.format(trait_dict['name'], trait_dict['dataset']))
+ trait_dict['hmac'] = f"{trait_dict['display_name']}:{trait_dict['dataset']}:{hmac_creation('{}:{}'.format(trait_dict['display_name'], trait_dict['dataset']))}"
permissions = check_resource_availability(
self.dataset, g.user_session.user_id, trait_dict['display_name'])
if not any(x in permissions['data'] for x in ["view", "edit"]):