diff --git a/caimira/apps/calculator/report_generator.py b/caimira/apps/calculator/report_generator.py index 81a64543..1dcfa00d 100644 --- a/caimira/apps/calculator/report_generator.py +++ b/caimira/apps/calculator/report_generator.py @@ -155,7 +155,7 @@ def calculate_report_data(form: FormData, model: models.ExposureModel) -> typing } -def generate_permalink(base_url, calculator_prefix, form: FormData): +def generate_permalink(base_url, get_root_url, get_root_calculator_url, form: FormData): form_dict = FormData.to_dict(form, strip_defaults=True) # Generate the calculator URL arguments that would be needed to re-create this @@ -165,8 +165,8 @@ def generate_permalink(base_url, calculator_prefix, form: FormData): # Then zlib compress + base64 encode the string. To be inverted by the # /_c/ endpoint. compressed_args = base64.b64encode(zlib.compress(args.encode())).decode() - qr_url = f"{base_url}/_c/{compressed_args}" - url = f"{base_url}{calculator_prefix}?{args}" + qr_url = f"{base_url}{get_root_url()}/_c/{compressed_args}" + url = f"{base_url}{get_root_calculator_url()}?{args}" return { 'link': url, @@ -342,7 +342,8 @@ def comparison_report( @dataclasses.dataclass class ReportGenerator: jinja_loader: jinja2.BaseLoader - calculator_prefix: str + get_root_url: typing.Any + get_root_calculator_url: typing.Any def build_report( self, @@ -377,8 +378,9 @@ class ReportGenerator: context['alternative_scenarios'] = comparison_report( form, report_data, alternative_scenarios, scenario_sample_times, executor_factory=executor_factory, ) - context['permalink'] = generate_permalink(base_url, self.calculator_prefix, form) - context['calculator_prefix'] = self.calculator_prefix + context['permalink'] = generate_permalink(base_url, self.get_root_url, self.get_root_calculator_url, form) + context['get_url'] = self.get_root_url + context['get_calculator_url'] = self.get_root_calculator_url return context @@ -387,7 +389,7 @@ class ReportGenerator: loader=self.jinja_loader, undefined=jinja2.StrictUndefined, ) - env.globals['common_text'] = markdown_tools.extract_rendered_markdown_blocks( + env.globals["common_text"] = markdown_tools.extract_rendered_markdown_blocks( env.get_template('common_text.md.j2') ) env.filters['non_zero_percentage'] = non_zero_percentage @@ -401,4 +403,4 @@ class ReportGenerator: def render(self, context: dict) -> str: template = self._template_environment().get_template("calculator.report.html.j2") - return template.render(**context, text_blocks=template.globals['common_text']) + return template.render(**context, text_blocks=template.globals["common_text"]) diff --git a/caimira/apps/templates/about.html.j2 b/caimira/apps/templates/about.html.j2 index 2ecce51d..606710b8 100644 --- a/caimira/apps/templates/about.html.j2 +++ b/caimira/apps/templates/about.html.j2 @@ -14,8 +14,8 @@ For information on the Airborne Transmission of SARS-CoV-2, feel free to check o CAiMIRA stands for CERN Airborne Model for Indoor Risk Assessment, previously known as CARA - COVID Airborne Risk Assessment, developed in the spring of 2020 to better understand and quantify the risk of long-range airborne spread of SARS-CoV-2 virus in workplaces. Since then, the model has evolved and now is capable of simulating the short-range component. CAiMIRA comes with different applications that allow more or less flexibility in the input parameters: The mathematical and physical model simulate the airborne spread of SARS-CoV-2 virus in a finite volume, assuming a homogenous mixture and a two-stage exhaled jet model, and estimates the risk of COVID-19 airborne transmission therein. The results DO NOT include other known modes of SARS-CoV-2 transmission. Hence, the output from this model is only valid when the other recommended public health & safety instructions are observed, such as good hand hygiene and other barrier measures.
diff --git a/caimira/apps/templates/base/calculator.form.html.j2 b/caimira/apps/templates/base/calculator.form.html.j2 index 06ad852a..fb25af92 100644 --- a/caimira/apps/templates/base/calculator.form.html.j2 +++ b/caimira/apps/templates/base/calculator.form.html.j2 @@ -5,13 +5,13 @@ {% block extra_headers %} - + {% endblock extra_headers %} {% block body_scripts %} - + {% endblock body_scripts %} @@ -21,7 +21,7 @@ {% if DEBUG %}
{% else %} - + {% endif %} {{ xsrf_form_html }} @@ -31,7 +31,7 @@

Calculator

- +
@@ -222,7 +222,7 @@ If these conditions are not met, the air exchange might not be homogenous producing an artificially lower risk further away from the window.

- + @@ -327,14 +327,14 @@
@@ -342,7 +342,7 @@ @@ -717,13 +717,13 @@
  • If coffee breaks are included, they are spread out evenly throughout the day, in addition to any lunch break (if applicable).
  • - Refer to Calculator App user guide + Refer to Calculator App user guide for more detailed explanations on how to use this tool.
    - - + +
    {% block covid_information%} {% endblock covid_information%} @@ -85,7 +85,7 @@
    - Logo + Logo

    CERN strives to deploy its know-how and technologies to help solve the challenges arising in the local and global fight against COVID-19. As a particle physics research organisation, CERN is not in a position to advise on medical research, health or health @@ -103,17 +103,17 @@

    - + - - + + - + - + - + {% block body_scripts %} {% endblock body_scripts %} diff --git a/caimira/apps/templates/cern/calculator.report.html.j2 b/caimira/apps/templates/cern/calculator.report.html.j2 index 7a50d768..5176d5b2 100644 --- a/caimira/apps/templates/cern/calculator.report.html.j2 +++ b/caimira/apps/templates/cern/calculator.report.html.j2 @@ -181,7 +181,7 @@
    -
    +

    diff --git a/caimira/apps/templates/cern/index.html.j2 b/caimira/apps/templates/cern/index.html.j2 index 1dba0804..149d2c3f 100644 --- a/caimira/apps/templates/cern/index.html.j2 +++ b/caimira/apps/templates/cern/index.html.j2 @@ -5,7 +5,7 @@

    CAiMIRA has been developed by CERN with the intention of allowing members of personnel with roles related to supervision, health & safety or space management to simulate the concerned workplaces on CERN sites. - A hosted CERN version of the CAiMIRA Calculator is available on this site to members of the CERN personnel. + A hosted CERN version of the CAiMIRA Calculator is available on this site to members of the CERN personnel.

    {% endblock caimira_at_cern %} \ No newline at end of file