From bc4e6c4720e5d7b6af8e04a679d8243b1bf2d254 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Tue, 15 Mar 2022 12:01:30 +0000 Subject: [PATCH] Added warning texts for face mask wearing when short_range_yes is selected --- cara/apps/calculator/static/js/form.js | 11 +++++++++++ cara/apps/calculator/static/js/report.js | 6 ++++-- cara/apps/templates/base/calculator.form.html.j2 | 5 ++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js index bcf393d6..61e7e204 100644 --- a/cara/apps/calculator/static/js/form.js +++ b/cara/apps/calculator/static/js/form.js @@ -256,6 +256,17 @@ function on_short_range_option_change() { if (this.checked) { getChildElement($(this)).show(); require_fields(this); + // Disable face mask selection if short_range_yes is selected + if (this.id == "short_range_yes") { + $('#mask_off').click(); + require_mask(false); + $('input[name="mask_wearing_option"]').attr('disabled', true); + $("#face_mask_warning").show(); + } + else { + $('input[name="mask_wearing_option"]').attr('disabled', false); + $("#face_mask_warning").hide(); + } } else { getChildElement($(this)).hide(); diff --git a/cara/apps/calculator/static/js/report.js b/cara/apps/calculator/static/js/report.js index 1ca78c26..a2fd0d86 100644 --- a/cara/apps/calculator/static/js/report.js +++ b/cara/apps/calculator/static/js/report.js @@ -820,8 +820,10 @@ function draw_plot(svg_id, times, concentrations, short_range_concentrations, cu // If user double click, reinitialize the chart vis.on("dblclick",function(){ - button_full_exposure.disabled = true; - button_long_exposure.disabled = false; + if (button_full_exposure || button_long_exposure) { + button_full_exposure.disabled = true; + button_long_exposure.disabled = false; + } yRange.domain([0., Math.max(...short_range_concentrations)]) yAxisEl.transition().call(d3.axisLeft(yRange)) lineFunc.defined(d => !isNaN(d.concentration)) diff --git a/cara/apps/templates/base/calculator.form.html.j2 b/cara/apps/templates/base/calculator.form.html.j2 index ad51ddf8..689c7260 100644 --- a/cara/apps/templates/base/calculator.form.html.j2 +++ b/cara/apps/templates/base/calculator.form.html.j2 @@ -268,6 +268,7 @@
+

Face mask selection is disabled due to short range interaction modeling.

+

Short range interactions are modeled without masks. If you are using this option, masks will not be taken into account.

0 short range interactions.

@@ -387,9 +389,6 @@