aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2023-02-14 22:32:35 +0000
committerzsloan2023-02-14 22:32:35 +0000
commit00a8f9996f19a95d8f5840993d504e06cb585dfa (patch)
tree88529b90a8de854d90618cc6236b4ecf3cfd46a0
parentdb3c7d0e75544db4f2fce685051545eedaee6546 (diff)
downloadgenenetwork2-00a8f9996f19a95d8f5840993d504e06cb585dfa.tar.gz
Fix collection page error when ProbeSet/Publish traits don't have a mean
-rw-r--r--wqflask/base/trait.py10
-rw-r--r--wqflask/wqflask/templates/collections/view.html6
2 files changed, 12 insertions, 4 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 4352c527..7501306a 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -300,9 +300,13 @@ def jsonable(trait, dataset=None):
dataset_type=trait.dataset.type,
group_name=trait.dataset.group.name)
+
trait_symbol = "N/A"
+ trait_mean = "N/A"
if trait.symbol:
trait_symbol = trait.symbol
+ if trait.mean:
+ trait_mean = trait.mean
if dataset.type == "ProbeSet":
return dict(name=trait.name,
@@ -313,7 +317,7 @@ def jsonable(trait, dataset=None):
dataset=dataset.name,
dataset_name=dataset.shortname,
description=trait.description_display,
- mean=trait.mean,
+ mean=trait_mean,
location=trait.location_repr,
chr=trait.chr,
mb=trait.mb,
@@ -338,7 +342,7 @@ def jsonable(trait, dataset=None):
pubmed_id=trait.pubmed_id,
pubmed_text=trait.pubmed_text,
pubmed_link=trait.pubmed_link,
- mean=trait.mean,
+ mean=trait_mean,
lrs_score=trait.LRS_score_repr,
lrs_location=trait.LRS_location_repr,
lrs_chr=trait.locus_chr,
@@ -357,7 +361,7 @@ def jsonable(trait, dataset=None):
abbreviation=trait.abbreviation,
authors=trait.authors,
pubmed_text=trait.pubmed_text,
- mean=trait.mean,
+ mean=trait_mean,
lrs_score=trait.LRS_score_repr,
lrs_location=trait.LRS_location_repr,
lrs_chr=trait.locus_chr,
diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html
index 3d7098af..1d9b7bcd 100644
--- a/wqflask/wqflask/templates/collections/view.html
+++ b/wqflask/wqflask/templates/collections/view.html
@@ -239,7 +239,11 @@
'orderSequence': [ "desc", "asc"],
'render': function(data) {
if (Object.hasOwn(data, 'mean')){
- return data.mean.toFixed(3)
+ if (data.mean != 'N/A'){
+ return data.mean.toFixed(3)
+ } else {
+ return "N/A"
+ }
} else {
return "N/A"
}