aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2021-08-12 21:55:26 +0000
committerzsloan2021-08-12 21:55:26 +0000
commiteecaad2dac6efa885540287a7ef5a273c6d18be2 (patch)
tree9eed6c82505b79279f6b14835edaaf8e574f3969
parent67bab7f9cd12ceb7ea0b0ac4b0b98c24935f3ab5 (diff)
downloadgenenetwork2-eecaad2dac6efa885540287a7ef5a273c6d18be2.tar.gz
Get case attribute descriptions from DB and display them as mouseover titles in the sample table headers for the trait page
-rw-r--r--wqflask/wqflask/show_trait/SampleList.py7
-rw-r--r--wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js2
2 files changed, 5 insertions, 4 deletions
diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py
index e4bbe5b9..ae30aa59 100644
--- a/wqflask/wqflask/show_trait/SampleList.py
+++ b/wqflask/wqflask/show_trait/SampleList.py
@@ -124,18 +124,19 @@ class SampleList:
# Get attribute names and distinct values for each attribute
results = g.db.execute('''
- SELECT DISTINCT CaseAttribute.Id, CaseAttribute.Name, CaseAttributeXRefNew.Value
+ SELECT DISTINCT CaseAttribute.Id, CaseAttribute.Name, CaseAttribute.Description, CaseAttributeXRefNew.Value
FROM CaseAttribute, CaseAttributeXRefNew
WHERE CaseAttributeXRefNew.CaseAttributeId = CaseAttribute.Id
AND CaseAttributeXRefNew.InbredSetId = %s
ORDER BY CaseAttribute.Id''', (str(self.dataset.group.id),))
self.attributes = {}
- for attr, values in itertools.groupby(results.fetchall(), lambda row: (row.Id, row.Name)):
- key, name = attr
+ for attr, values in itertools.groupby(results.fetchall(), lambda row: (row.Id, row.Name, row.Description)):
+ key, name, description = attr
self.attributes[key] = Bunch()
self.attributes[key].id = key
self.attributes[key].name = name
+ self.attributes[key].description = description
self.attributes[key].distinct_values = [
item.Value for item in values]
self.attributes[key].distinct_values = natural_sort(
diff --git a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
index 49311f87..4de1b0ac 100644
--- a/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
+++ b/wqflask/wqflask/static/new/javascript/initialize_show_trait_tables.js
@@ -97,7 +97,7 @@ build_columns = function() {
for (i = 0; i < attr_keys.length; i++){
column_list.push(
{
- 'title': "<div style='text-align: " + js_data.attributes[attr_keys[i]].alignment + "'>" + js_data.attributes[attr_keys[i]].name + "</div>",
+ 'title': "<div title='" + js_data.attributes[attr_keys[i]].description + "' style='text-align: " + js_data.attributes[attr_keys[i]].alignment + "'>" + js_data.attributes[attr_keys[i]].name + "</div>",
'type': "natural",
'data': null,
'render': function(data, type, row, meta) {