aboutsummaryrefslogtreecommitdiff
path: root/uploader
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-01-23 14:48:29 -0600
committerFrederick Muriuki Muriithi2025-01-23 14:48:29 -0600
commit7b626ecd21699bd809643aefeea7a075a96a4e66 (patch)
tree6b4f800e6d7d096893f14374d7dcaecba0f62943 /uploader
parentaf3894def4696ce6d61e1354a9b9f1431b161302 (diff)
downloadgn-uploader-7b626ecd21699bd809643aefeea7a075a96a4e66.tar.gz
Only present SE and N columns if at least one row has them.
Diffstat (limited to 'uploader')
-rw-r--r--uploader/phenotypes/views.py12
-rw-r--r--uploader/templates/phenotypes/view-phenotype.html7
2 files changed, 12 insertions, 7 deletions
diff --git a/uploader/phenotypes/views.py b/uploader/phenotypes/views.py
index 53e68d1..9c5c71a 100644
--- a/uploader/phenotypes/views.py
+++ b/uploader/phenotypes/views.py
@@ -220,16 +220,18 @@ def view_phenotype(# pylint: disable=[unused-argument]
):
"""View an individual phenotype from the dataset."""
def __render__(privileges):
+ phenotype = phenotype_by_id(conn,
+ species["SpeciesId"],
+ population["Id"],
+ dataset["Id"],
+ xref_id)
return render_template(
"phenotypes/view-phenotype.html",
species=species,
population=population,
dataset=dataset,
- phenotype=phenotype_by_id(conn,
- species["SpeciesId"],
- population["Id"],
- dataset["Id"],
- xref_id),
+ phenotype=phenotype,
+ has_se=all(bool(item.get("error")) for item in phenotype["data"]),
privileges=(privileges
### For demo! Do not commit this part
+ ("group:resource:edit-resource",
diff --git a/uploader/templates/phenotypes/view-phenotype.html b/uploader/templates/phenotypes/view-phenotype.html
index 077a301..5ed45b7 100644
--- a/uploader/templates/phenotypes/view-phenotype.html
+++ b/uploader/templates/phenotypes/view-phenotype.html
@@ -90,8 +90,10 @@
<th>#</th>
<th>Sample</th>
<th>Value</th>
- <th>SE</th>
+ {%if has_se%}
+ <th>SE: {{has_se}}</th>
<th>N</th>
+ {%endif%}
</tr>
</thead>
@@ -101,9 +103,10 @@
<td>{{loop.index}}</td>
<td>{{item.StrainName}}</td>
<td>{{item.value}}</td>
- <td>{{item.Symbol or "-"}}</td>
+ {%if has_se%}
<td>{{item.error or "-"}}</td>
<td>{{item.count or "-"}}</td>
+ {%endif%}
</tr>
{%endfor%}
</tbody>