From b62f5a989db9835e29a70107801c549717a0415f Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Tue, 6 Jul 2021 17:16:03 +0200 Subject: [PATCH] fix #173 Covid Level png image added to the warning and CSS tricks using flex layout --- cara/apps/calculator/report_generator.py | 10 +++++----- cara/apps/calculator/static/css/report.css | 6 ++++++ .../calculator/static/images/warning_level3.jpeg | Bin 0 -> 6920 bytes .../templates/base/calculator.report.html.j2 | 8 ++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 cara/apps/calculator/static/images/warning_level3.jpeg diff --git a/cara/apps/calculator/report_generator.py b/cara/apps/calculator/report_generator.py index e8aa9580..45dea024 100644 --- a/cara/apps/calculator/report_generator.py +++ b/cara/apps/calculator/report_generator.py @@ -279,22 +279,22 @@ def comparison_report(scenarios: typing.Dict[str, models.ExposureModel]): def get_level_warning(scale_warning, incidence_rate, onsite_access, threshold) -> dict: if scale_warning == 'Green - 1': scale_level = { - 'level': 1, + 'display_png': 'cara/apps/calculator/static/images/warning_level3.jpeg', 'display_text': f'Note: the current CERN COVID Scale is Green - 1, which means the incidence rate in the local community is {incidence_rate}. Align your risk assessment with the guidance and instructions provided by the HSE Unit.' } elif scale_warning == 'Yellow - 2': scale_level = { - 'level': 2, + 'display_png': 'cara/apps/calculator/static/images/warning_level3.jpeg', 'display_text': f'Note: the current CERN COVID Scale is Yellow - 2, which means the incidence rate in the local community is {incidence_rate}. There is a reduced chance that asymptomatic or pre-symptomatic infected individuals circulate within the CERN site which, during this stage, corresponds to an average daily on-site access {onsite_access}. See with your supervisor if this scenario is acceptable.' } elif scale_warning == 'Orange - 3': scale_level = { - 'level': 3, + 'display_png': 'cara/apps/calculator/static/images/warning_level3.jpeg', 'display_text': f'Warning: the current CERN COVID Scale is Orange - 3, which means the incidence rate in the local community is {incidence_rate}. There is a slight chance that asymptomatic or pre-symptomatic infected individuals circulate within the CERN site which, during this stage, corresponds to an average daily on-site access {onsite_access}. See with your supervisor if any additional measures can be applied (ALARA).' } elif scale_warning == 'Red - 4': scale_level = { - 'level': 4, + 'display_png': '/static/images/warning_level3.jpeg', 'display_text': f'Warning: the current CERN COVID Scale is Red - 4, which means the incidence rate in the local community is {incidence_rate}. There is a strong chance that asymptomatic or pre-symptomatic infected individuals circulate within the CERN site which, during this stage, corresponds to an average daily on-site access {onsite_access}. Please reduce the value below the threshold of {threshold}.' } return scale_level @@ -337,7 +337,7 @@ class ReportGenerator: onsite_access = 'lower than 4000' threshold = '5%' ''' - scale_warning = get_level_warning(scale_warning = 'Green - 1', incidence_rate = 'higher or equal to 100 new cases per 100 000 inhabitants', onsite_access = 'lower than 4000', threshold = '') + scale_warning = get_level_warning(scale_warning = 'Red - 4', incidence_rate = 'higher or equal to 100 new cases per 100 000 inhabitants', onsite_access = 'lower than 4000', threshold = '') context = { 'model': model, diff --git a/cara/apps/calculator/static/css/report.css b/cara/apps/calculator/static/css/report.css index 4a67fc55..094374fa 100644 --- a/cara/apps/calculator/static/css/report.css +++ b/cara/apps/calculator/static/css/report.css @@ -68,3 +68,9 @@ p.notes { background-color: #90EE90; text-decoration: none; } + +/* Flexbox layouts */ +.flex_space_between { + display: flex; + justify-content: space-between; +} diff --git a/cara/apps/calculator/static/images/warning_level3.jpeg b/cara/apps/calculator/static/images/warning_level3.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..3c7c6bf29344ba0b80c44ccaf70ad5b694ca3409 GIT binary patch literal 6920 zcmd5=c{r4B+kP0bCD|g%lzofry9o`3knDR&h!C>JC|ixPFDXl5vJ57&We<^c?6PN% z$eyvx%=h$e-|yG^9mlu4?;qbY$9>E($6WV)U*~;Z%XvSfFQl))X&p_3CO}3;2HXTc z0BHiy0BEVGsHslSQd3jY(bCeLVn2O~p8nK%)-#OkJWxJfZYcLfei1owej#b0i`{^#I7PVl(pqlRF!@$LPkqRcZ&Yhxznf5DG725D*dk?QWL;P4MdWifsk00jUtO3>S14*%^TBZp8>o}i+pp``;2Doz9BWDp2B1%#54f&#P-2LA^r z7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h6nzhR{gxusK0d4hyI_24DhlZV(Iy7IRh>QeRV(2~zz|)d|S*<@a{Pwr0 zv3Ol&1enb0S|otn?%1U8b7S5E(qZzO5#KL8Z!YK8y+ literal 0 HcmV?d00001 diff --git a/cara/apps/calculator/templates/base/calculator.report.html.j2 b/cara/apps/calculator/templates/base/calculator.report.html.j2 index 79e8d649..54f4b222 100644 --- a/cara/apps/calculator/templates/base/calculator.report.html.j2 +++ b/cara/apps/calculator/templates/base/calculator.report.html.j2 @@ -214,8 +214,12 @@ Taking into account the uncertainties tied to the model variables, in this scenario, 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 }}. {% if (prob_inf > 5) %} -