Bug fixes to templating issues.
This commit is contained in:
@@ -26,7 +26,7 @@ from openpyxl.worksheet.worksheet import Worksheet
|
|||||||
from openpyxl.drawing.image import Image as OpenpyxlImage
|
from openpyxl.drawing.image import Image as OpenpyxlImage
|
||||||
from tools import row_map, setup_lookup, jinja_template_loading, rreplace, row_keys, check_key_or_attr, Result, Report
|
from tools import row_map, setup_lookup, jinja_template_loading, rreplace, row_keys, check_key_or_attr, Result, Report
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
from typing import List, Any, Tuple, Literal, Generator
|
from typing import List, Any, Tuple, Literal
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from jinja2.exceptions import TemplateNotFound
|
from jinja2.exceptions import TemplateNotFound
|
||||||
@@ -1295,16 +1295,6 @@ class BacterialCulture(BasicSubmission):
|
|||||||
output['controls'] = [item.to_sub_dict() for item in self.controls]
|
output['controls'] = [item.to_sub_dict() for item in self.controls]
|
||||||
return output
|
return output
|
||||||
|
|
||||||
# @classmethod
|
|
||||||
# def get_regex(cls) -> str:
|
|
||||||
# """
|
|
||||||
# Retrieves string for regex construction.
|
|
||||||
#
|
|
||||||
# Returns:
|
|
||||||
# str: string for regex construction
|
|
||||||
# """
|
|
||||||
# return "(?P<Bacterial_Culture>RSL(?:-|_)?BC(?:-|_)?20\d{2}-?\d{2}-?\d{2}(?:(_|-)?\d?([^_0123456789\sA-QS-Z]|$)?R?\d?)?)"
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def filename_template(cls):
|
def filename_template(cls):
|
||||||
"""
|
"""
|
||||||
@@ -1491,16 +1481,6 @@ class Wastewater(BasicSubmission):
|
|||||||
outstr = super().enforce_name(instr=instr, data=data)
|
outstr = super().enforce_name(instr=instr, data=data)
|
||||||
return outstr
|
return outstr
|
||||||
|
|
||||||
# @classmethod
|
|
||||||
# def get_regex(cls) -> str:
|
|
||||||
# """
|
|
||||||
# Retrieves string for regex construction
|
|
||||||
#
|
|
||||||
# Returns:
|
|
||||||
# str: String for regex construction
|
|
||||||
# """
|
|
||||||
# return "(?P<Wastewater>RSL(?:-|_)?WW(?:-|_)?20\d{2}-?\d{2}-?\d{2}(?:(_|-)?\d?([^_0123456789\sA-QS-Z]|$)?R?\d?)?)"
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def adjust_autofill_samples(cls, samples: List[Any]) -> List[Any]:
|
def adjust_autofill_samples(cls, samples: List[Any]) -> List[Any]:
|
||||||
"""
|
"""
|
||||||
@@ -1629,7 +1609,7 @@ class Wastewater(BasicSubmission):
|
|||||||
continue
|
continue
|
||||||
copy = dict(submitter_id=sample['submitter_id'], row=row, column=column)
|
copy = dict(submitter_id=sample['submitter_id'], row=row, column=column)
|
||||||
well_24.append(copy)
|
well_24.append(copy)
|
||||||
input_dict['origin_plate'] = DocxWriter.create_plate_map(sample_list=well_24, rows=4, columns=6)
|
input_dict['origin_plate'] = [item for item in DocxWriter.create_plate_map(sample_list=well_24, rows=4, columns=6)]
|
||||||
return input_dict
|
return input_dict
|
||||||
|
|
||||||
|
|
||||||
@@ -1911,16 +1891,6 @@ class WastewaterArtic(BasicSubmission):
|
|||||||
# logger.debug(f"Final EN name: {final_en_name}")
|
# logger.debug(f"Final EN name: {final_en_name}")
|
||||||
return final_en_name
|
return final_en_name
|
||||||
|
|
||||||
# @classmethod
|
|
||||||
# def get_regex(cls) -> str:
|
|
||||||
# """
|
|
||||||
# Retrieves string for regex construction
|
|
||||||
#
|
|
||||||
# Returns:
|
|
||||||
# str: string for regex construction.
|
|
||||||
# """
|
|
||||||
# return "(?P<Wastewater_Artic>(\\d{4}-\\d{2}-\\d{2}(?:-|_)(?:\\d_)?artic)|(RSL(?:-|_)?AR(?:-|_)?20\\d{2}-?\\d{2}-?\\d{2}(?:(_|-)\\d?(\\D|$)R?\\d?)?))"
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def finalize_parse(cls, input_dict: dict, xl: pd.ExcelFile | None = None, info_map: dict | None = None) -> dict:
|
def finalize_parse(cls, input_dict: dict, xl: pd.ExcelFile | None = None, info_map: dict | None = None) -> dict:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -172,6 +172,8 @@ class SubmissionDetails(QDialog):
|
|||||||
"""
|
"""
|
||||||
export_plate = BasicSubmission.query(rsl_plate_num=self.export_plate)
|
export_plate = BasicSubmission.query(rsl_plate_num=self.export_plate)
|
||||||
base_dict = export_plate.to_dict(full_data=True)
|
base_dict = export_plate.to_dict(full_data=True)
|
||||||
|
base_dict['excluded'] = export_plate.get_default_info('details_ignore')
|
||||||
|
logger.debug(f"base dict: {pformat(base_dict)}")
|
||||||
writer = DocxWriter(base_dict=base_dict)
|
writer = DocxWriter(base_dict=base_dict)
|
||||||
fname = select_save_file(obj=self, default_name=base_dict['plate_number'], extension="docx")
|
fname = select_save_file(obj=self, default_name=base_dict['plate_number'], extension="docx")
|
||||||
writer.save(fname)
|
writer.save(fname)
|
||||||
|
|||||||
@@ -22,4 +22,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block signing_button %}
|
||||||
|
{{ super() }}
|
||||||
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
@@ -66,6 +66,8 @@
|
|||||||
<h3><u>Plate map:</u></h3>
|
<h3><u>Plate map:</u></h3>
|
||||||
<img height="600px" width="1300px" src="data:image/jpeg;base64,{{ sub['export_map'] | safe }}">
|
<img height="600px" width="1300px" src="data:image/jpeg;base64,{{ sub['export_map'] | safe }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
{% block signing_button %}
|
||||||
{% if signing_permission %}
|
{% if signing_permission %}
|
||||||
<button type="button" id="sign_btn">Sign Off</button>
|
<button type="button" id="sign_btn">Sign Off</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -82,8 +84,6 @@
|
|||||||
document.getElementById("{{ sample['submitter_id'] }}").addEventListener("click", function(){
|
document.getElementById("{{ sample['submitter_id'] }}").addEventListener("click", function(){
|
||||||
backend.sample_details("{{ sample['submitter_id'] }}");
|
backend.sample_details("{{ sample['submitter_id'] }}");
|
||||||
});
|
});
|
||||||
{% endfor %}
|
|
||||||
{% for sample in sub['samples'] %}
|
|
||||||
document.getElementById("{{ sample['submitter_id'] }}_alpha").addEventListener("click", function(){
|
document.getElementById("{{ sample['submitter_id'] }}_alpha").addEventListener("click", function(){
|
||||||
backend.sample_details("{{ sample['submitter_id'] }}");
|
backend.sample_details("{{ sample['submitter_id'] }}");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
{% block body %}
|
{% block body %}
|
||||||
<!--<button type="button" id="back_btn">Back</button>-->
|
<!--<button type="button" id="back_btn">Back</button>-->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block signing_button %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
{% block script %}
|
{% block script %}
|
||||||
|
|||||||
@@ -31,4 +31,7 @@
|
|||||||
{{ sub['origin_plate'] }}
|
{{ sub['origin_plate'] }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block signing_button %}
|
||||||
|
{{ super() }}
|
||||||
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Binary file not shown.
@@ -35,4 +35,7 @@
|
|||||||
<br/>
|
<br/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block signing_button %}
|
||||||
|
{{ super() }}
|
||||||
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user