Skip to content
Snippets Groups Projects
Commit b7a3250b authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

avoid crashing PCA and LE-LLE views if no data available

parent 1c95e9d6
Branches main
No related tags found
1 merge request!13Master
......@@ -6,7 +6,7 @@
{% block pagetitle %}Efficiencies: iPPI-DB biplot LE versus LLE{% endblock%}
{% block view_content %}
{% if le_lle_biplot_data %}
<div class="row">
<div class="col-md-12">
<canvas id="le_lle_biplot"></canvas>
......@@ -21,4 +21,9 @@
<script>
drawCompoundsBiplotChart('le_lle_biplot', preparePerFamilyBiplotData({{ le_lle_biplot_data | safe }}), 'pharmacology', {'legend':{'position':'right'}});
</script>
{% else %}
<div class="alert alert-danger" role="alert">
The LE-LLE data are not currently available
</div>
{% endif %}
{% endblock %}
......@@ -5,6 +5,7 @@
{% block pagetitle %}PHYSICOCHEMISTRY{% endblock%}
{% block view_content %}
{% if pca_biplot_data %}
<div class="row">
<canvas id="pca_biplot"></canvas>
</div>
......@@ -17,4 +18,9 @@
<script>
drawCompoundsBiplotChart('pca_biplot', preparePerFamilyBiplotData({{ pca_biplot_data | safe }}.data), 'physicochemical', { 'legend': { 'position': 'right' } });
</script>
{% else %}
<div class="alert alert-danger" role="alert">
The PCA data are not currently available
</div>
{% endif %}
{% endblock %}
\ No newline at end of file
......@@ -149,7 +149,10 @@ def about_pharmacology(request):
def about_le_lle(request):
context = {"le_lle_biplot_data": LeLleBiplotData.objects.get().le_lle_biplot_data}
try:
context = {"le_lle_biplot_data": LeLleBiplotData.objects.get().le_lle_biplot_data}
except LeLleBiplotData.DoesNotExist:
context = {}
return render(request, "about-le-lle.html", context=context)
......@@ -249,7 +252,10 @@ def about_physicochemistry(request):
def about_pca(request):
context = {"pca_biplot_data": PcaBiplotData.objects.get().pca_biplot_data}
pca_biplot = json.loads(PcaBiplotData.objects.get().pca_biplot_data)
context["pca_biplot_cc"] = pca_biplot["correlation_circle"]
try:
context = {"pca_biplot_data": PcaBiplotData.objects.get().pca_biplot_data}
pca_biplot = json.loads(PcaBiplotData.objects.get().pca_biplot_data)
context["pca_biplot_cc"] = pca_biplot["correlation_circle"]
except PcaBiplotData.DoesNotExist:
context = {}
return render(request, "about-pca.html", context=context)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment