From f8108ccd3dcd0bc59ebf436dd82375a8e303bd08 Mon Sep 17 00:00:00 2001 From: luissian Date: Sat, 28 Sep 2024 22:47:19 +0200 Subject: [PATCH] Solved issue #322 No extraction parameter fields are showed --- django_utils/templatetags/replace_spaces.py | 8 ++++++++ wetlab/templates/wetlab/handling_molecules.html | 11 ++++++----- wetlab/utils/statistics.py | 1 - 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 django_utils/templatetags/replace_spaces.py diff --git a/django_utils/templatetags/replace_spaces.py b/django_utils/templatetags/replace_spaces.py new file mode 100644 index 000000000..d3bf60fba --- /dev/null +++ b/django_utils/templatetags/replace_spaces.py @@ -0,0 +1,8 @@ +from django import template + +register = template.Library() + + +@register.filter +def replace_spaces_with_underscores(value): + return value.replace(" ", "_") diff --git a/wetlab/templates/wetlab/handling_molecules.html b/wetlab/templates/wetlab/handling_molecules.html index 9103d258a..9af67a779 100644 --- a/wetlab/templates/wetlab/handling_molecules.html +++ b/wetlab/templates/wetlab/handling_molecules.html @@ -1,5 +1,6 @@ {% extends "core/base.html" %} {% load static %} +{% load replace_spaces %} {% block content %} {% include "wetlab/menu.html" %} {% include 'core/jexcel_functionality.html' %} @@ -125,7 +126,7 @@

Update sample extraction data with defined parameters

Protocol: {{ prot }}
-
+
{% endfor %} @@ -637,12 +638,12 @@

Not molecule uses have been defined yet

{% if molecule_parameters %} $(document).ready(function () { {% for prot , value_dict in molecule_parameters.items %} - var {{ prot }}_data = [{% for values in value_dict.m_data %} + var {{ prot|replace_spaces_with_underscores }}_data = [{% for values in value_dict.m_data %} [{% for value in values %}'{{value}}',{% endfor %}],{% endfor %} ]; - var {{ prot }}_data_table = jspreadsheet(document.getElementById('spreadsheet_{{ prot }}'),{ - data:{{ prot }}_data, + var {{ prot|replace_spaces_with_underscores }}_data_table = jspreadsheet(document.getElementById('spreadsheet_{{ prot|replace_spaces_with_underscores }}'),{ + data:{{ prot|replace_spaces_with_underscores }}_data, columns: [ { type: 'hidden' }, { type: 'text', title:'{{value_dict.fix_heading.0}}', width:180 , readOnly:true }, @@ -670,7 +671,7 @@

Not molecule uses have been defined yet

$("#addExtractionParameters").submit(function (e) { - var table_data = {{ prot }}_data_table.getData() + var table_data = {{ prot|replace_spaces_with_underscores }}_data_table.getData() var data_json = JSON.stringify(table_data) $("").attr("type", "hidden") .attr("name", "{{ prot }}") diff --git a/wetlab/utils/statistics.py b/wetlab/utils/statistics.py index f8847d645..0632a84f0 100644 --- a/wetlab/utils/statistics.py +++ b/wetlab/utils/statistics.py @@ -892,7 +892,6 @@ def _lab_statistics( g_data, ).render() ) - # import pdb; pdb.set_trace() return research_lab_statistics research_lab_statistics = {}