diff --git a/cara/apps/calculator/report_generator.py b/cara/apps/calculator/report_generator.py index e3113dcb..789d8865 100644 --- a/cara/apps/calculator/report_generator.py +++ b/cara/apps/calculator/report_generator.py @@ -256,6 +256,10 @@ def manufacture_alternative_scenarios(form: FormData) -> typing.Dict[str, mc.Exp without_mask_or_vent = dataclass_utils.replace(without_mask, ventilation_type='no_ventilation') scenarios['No ventilation with Type I masks'] = with_mask_no_vent.build_mc_model() scenarios['Neither ventilation nor masks'] = without_mask_or_vent.build_mc_model() + + else: + no_short_range_alternative = dataclass_utils.replace(form, short_range_interactions=[]) + scenarios['Base scenario without short-range interactions'] = no_short_range_alternative.build_mc_model() return scenarios diff --git a/cara/apps/templates/base/calculator.report.html.j2 b/cara/apps/templates/base/calculator.report.html.j2 index 0d1f64da..5e033534 100644 --- a/cara/apps/templates/base/calculator.report.html.j2 +++ b/cara/apps/templates/base/calculator.report.html.j2 @@ -46,6 +46,13 @@
+ {% if form.short_range_option == "short_range_yes" %} + {% set scenario = alternative_scenarios.stats.values() | first %} + {% set long_range_prob_inf = scenario.probability_of_infection %} + {% else %} + {% set long_range_prob_inf = prob_inf %} + {% endif %} + {% block report_results %}
Results @@ -63,7 +70,9 @@
Probability of infection (%)
- {% if form.short_range_option == "short_range_yes" %} Without short range interactions {% endif %} + {% if form.short_range_option == "short_range_yes" %} + Without short range interactions + {% endif %}

@@ -111,7 +120,7 @@ {% if form.short_range_option == "short_range_yes" %}
{% endif %}
diff --git a/cara/apps/templates/cern/calculator.report.html.j2 b/cara/apps/templates/cern/calculator.report.html.j2 index 495b1401..8171b543 100644 --- a/cara/apps/templates/cern/calculator.report.html.j2 +++ b/cara/apps/templates/cern/calculator.report.html.j2 @@ -2,7 +2,14 @@ {% set cern_level = 'green-1' %} -{% if ((long_range_prob_inf > 10) or (long_range_expected_new_cases >= 1)) %} {% set long_range_scale_warning = 'red' %} +{% if form.short_range_option == "short_range_yes" %} + {% set scenario = alternative_scenarios.stats.values() | first %} + {% set long_range_prob_inf = scenario.probability_of_infection %} +{% else %} + {% set long_range_prob_inf = prob_inf %} +{% endif %} + +{% if ((long_range_prob_inf > 10) or (expected_new_cases >= 1)) %} {% set long_range_scale_warning = 'red' %} {% elif (2 <= long_range_prob_inf <= 10) %} {% set long_range_scale_warning = 'orange' %} {% else %} {% set long_range_scale_warning = 'green' %} {% endif %} @@ -23,6 +30,7 @@ {% elif long_range_scale_warning == 'orange' %} {% set long_range_warning_color = 'bg-warning' %} {% elif long_range_scale_warning == 'green' %} {% set long_range_warning_color = 'bg-success' %} {% endif %} +
{{long_range_prob_inf | non_zero_percentage}} @@ -47,7 +55,7 @@ {% endblock warning_animation %} {% block report_summary %} - {% set long_range_report_message = "Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the probability of one exposed occupant getting infected is " + long_range_prob_inf | non_zero_percentage + " and the expected number of new cases is " + long_range_expected_new_cases | float_format + "*." %} + {% set long_range_report_message = "Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the probability of one exposed occupant getting infected is " + long_range_prob_inf | non_zero_percentage + " and the expected number of new cases is " + expected_new_cases | float_format + "*." %}

{% if long_range_scale_warning == 'red' %} @@ -68,7 +76,7 @@ {% endif %} {% if form.short_range_option == "short_range_yes" %}
- {% set report_message = "Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the probability of one exposed occupant getting infected is " + prob_inf | non_zero_percentage + " and the expected number of new cases is " + expected_new_cases | float_format + "*." %} + {% set report_message = "Taking into account the uncertainties tied to the model variables, in this scenario and assuming all occupants are exposed equally, the probability of one exposed occupant getting infected is " + prob_inf | non_zero_percentage + "." %} {% if scale_warning == 'red' %}