aboutsummaryrefslogtreecommitdiff
path: root/gn2
diff options
context:
space:
mode:
authorzsloan2024-07-29 20:59:31 +0000
committerAlexander_Kabui2024-08-28 15:02:46 +0300
commit89e321120b6c43188fe7b1d3da205caefab06406 (patch)
treeeea95cde9c1fc96fbd61fac107d7c7df80083c71 /gn2
parentb14437638422d54e06bb6c1779b8c724f024aa1c (diff)
downloadgenenetwork2-89e321120b6c43188fe7b1d3da205caefab06406.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"]):