fix #173 Covid Level png image added to the warning and CSS tricks using flex layout
This commit is contained in:
parent
1e3e7f86cd
commit
b62f5a989d
4 changed files with 17 additions and 7 deletions
|
|
@ -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 <b>Green - 1</b>, which means the incidence rate in the local community is <b>{incidence_rate}</b>. 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 <b>Yellow - 2</b>, which means the incidence rate in the local community is <b>{incidence_rate}</b>. 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 <b>{onsite_access}</b>. 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 <b>Orange - 3</b>, which means the incidence rate in the local community is <b>{incidence_rate}</b>. 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 <b>{onsite_access}</b>. 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 <b>Red - 4</b>, which means the incidence rate in the local community is <b>{incidence_rate}</b>. 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 <b>{onsite_access}</b>. Please reduce the value below the threshold of <b>{threshold}</b>.'
|
||||
}
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -68,3 +68,9 @@ p.notes {
|
|||
background-color: #90EE90;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Flexbox layouts */
|
||||
.flex_space_between {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
|
|
|||
BIN
cara/apps/calculator/static/images/warning_level3.jpeg
Normal file
BIN
cara/apps/calculator/static/images/warning_level3.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
|
|
@ -214,8 +214,12 @@
|
|||
Taking into account the uncertainties tied to the model variables, in this scenario, the <b>probability of one exposed occupant getting infected is {{ prob_inf | non_zero_percentage }}</b><a href="#section1">[*]</a> and the <b>expected number of new cases is {{ expected_new_cases | float_format }}</b>.
|
||||
|
||||
{% if (prob_inf > 5) %}
|
||||
<div class="alert alert-dark" role="alert" style="width: 50%">
|
||||
{{scale_warning.display_text}}
|
||||
|
||||
<div class="flex_space_between">
|
||||
<img class="alert" src="{{ calculator_prefix }}{{ scale_warning.display_png }}">
|
||||
<div class="alert alert-dark" role="alert" style="width: 50%">
|
||||
{{scale_warning.display_text}}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue