Merge branch 'feature/month' into 'master'
removed individual date option Closes #137 See merge request cara/cara!134
This commit is contained in:
commit
819399df82
6 changed files with 18 additions and 81 deletions
|
|
@ -126,7 +126,6 @@ It is possible to specify a different time for the entry and exit of the infecte
|
|||
#### When is the event?
|
||||
|
||||
This is included for completeness in all simulations, however it is of particular relevance to those using natural ventilation because of variations in outside air temperature.
|
||||
If you wish to simulate repetitive events, for example using an office for multiple days in the same month, choose recurrent usage.
|
||||
|
||||
Only the month is used by the model to retrieve the average outdoor air temperatures for the Geneva region.
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ class FormData:
|
|||
ceiling_height: float
|
||||
coffee_breaks: int
|
||||
coffee_duration: int
|
||||
event_type: str
|
||||
floor_area: float
|
||||
hepa_amount: float
|
||||
hepa_option: bool
|
||||
|
|
@ -39,11 +38,10 @@ class FormData:
|
|||
mechanical_ventilation_type: str
|
||||
model_version: str
|
||||
opening_distance: float
|
||||
recurrent_event_month: str
|
||||
event_month: str
|
||||
room_number: str
|
||||
room_volume: float
|
||||
simulation_name: str
|
||||
single_event_date: str
|
||||
total_people: int
|
||||
ventilation_type: str
|
||||
volume_type: str
|
||||
|
|
@ -101,7 +99,6 @@ class FormData:
|
|||
ceiling_height=float(form_data['ceiling_height']),
|
||||
coffee_breaks=int(form_data['coffee_breaks']),
|
||||
coffee_duration=int(form_data['coffee_duration']),
|
||||
event_type=form_data['event_type'],
|
||||
floor_area=float(form_data['floor_area']),
|
||||
hepa_amount=float(form_data['hepa_amount']),
|
||||
hepa_option=form_data['hepa_option'],
|
||||
|
|
@ -114,11 +111,10 @@ class FormData:
|
|||
mechanical_ventilation_type=form_data['mechanical_ventilation_type'],
|
||||
model_version=form_data['model_version'],
|
||||
opening_distance=float(form_data['opening_distance']),
|
||||
recurrent_event_month=form_data['recurrent_event_month'],
|
||||
event_month=form_data['event_month'],
|
||||
room_number=form_data['room_number'],
|
||||
room_volume=float(form_data['room_volume']),
|
||||
simulation_name=form_data['simulation_name'],
|
||||
single_event_date=form_data['single_event_date'],
|
||||
total_people=int(form_data['total_people']),
|
||||
ventilation_type=form_data['ventilation_type'],
|
||||
volume_type=form_data['volume_type'],
|
||||
|
|
@ -149,7 +145,6 @@ class FormData:
|
|||
f"{start_name} must be less than {end_name}. Got {start} and {end}.")
|
||||
|
||||
validation_tuples = [('activity_type', ACTIVITY_TYPES),
|
||||
('event_type', EVENT_TYPES),
|
||||
('mechanical_ventilation_type', MECHANICAL_VENTILATION_TYPES),
|
||||
('mask_type', MASK_TYPES),
|
||||
('mask_wearing', MASK_WEARING),
|
||||
|
|
@ -180,11 +175,7 @@ class FormData:
|
|||
else:
|
||||
window_interval = always_on
|
||||
|
||||
if self.event_type == 'single_event':
|
||||
month_number = int(self.single_event_date.split('/')[1])
|
||||
month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][month_number - 1]
|
||||
else:
|
||||
month = self.recurrent_event_month[:3]
|
||||
month = self.event_month[:3]
|
||||
|
||||
inside_temp = models.PiecewiseConstant((0, 24), (293,))
|
||||
outside_temp = data.GenevaTemperatures[month]
|
||||
|
|
@ -514,7 +505,6 @@ def baseline_raw_form_data():
|
|||
'ceiling_height': '',
|
||||
'coffee_breaks': '4',
|
||||
'coffee_duration': '10',
|
||||
'event_type': 'recurrent_event',
|
||||
'floor_area': '',
|
||||
'hepa_amount': '250',
|
||||
'hepa_option': '0',
|
||||
|
|
@ -529,11 +519,10 @@ def baseline_raw_form_data():
|
|||
'mechanical_ventilation_type': '',
|
||||
'model_version': 'v1.2.0',
|
||||
'opening_distance': '0.2',
|
||||
'recurrent_event_month': 'January',
|
||||
'event_month': 'January',
|
||||
'room_number': '123',
|
||||
'room_volume': '75',
|
||||
'simulation_name': 'Test',
|
||||
'single_event_date': '',
|
||||
'total_people': '10',
|
||||
'ventilation_type': 'natural',
|
||||
'volume_type': 'room_volume',
|
||||
|
|
@ -548,7 +537,6 @@ def baseline_raw_form_data():
|
|||
|
||||
|
||||
ACTIVITY_TYPES = {'office', 'meeting', 'training', 'callcentre', 'library', 'workshop', 'lab', 'gym'}
|
||||
EVENT_TYPES = {'single_event', 'recurrent_event'}
|
||||
MECHANICAL_VENTILATION_TYPES = {'air_changes', 'air_supply', 'not-applicable'}
|
||||
MASK_TYPES = {'Type I', 'FFP2'}
|
||||
MASK_WEARING = {'continuous', 'removed'}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ function insertErrorFor(referenceNode, text) {
|
|||
var element = document.createElement("span");
|
||||
element.setAttribute("class", "error_text");
|
||||
element.classList.add("red_text");
|
||||
element.innerHTML = " " + text;
|
||||
element.innerHTML = " " + text;
|
||||
referenceNode.parentNode.insertBefore(element, referenceNode.nextSibling);
|
||||
}
|
||||
|
||||
|
|
@ -67,14 +67,6 @@ function require_fields(obj) {
|
|||
case "mask_off":
|
||||
require_mask(false);
|
||||
break;
|
||||
case "event_type_single":
|
||||
require_single_event(true);
|
||||
require_recurrent_event(false);
|
||||
break;
|
||||
case "event_type_recurrent":
|
||||
require_recurrent_event(true);
|
||||
require_single_event(false);
|
||||
break;
|
||||
case "lunch_option_no":
|
||||
require_lunch(false);
|
||||
break;
|
||||
|
|
@ -152,16 +144,6 @@ function require_venting(option) {
|
|||
set_disabled_status("#windows_frequency", !option);
|
||||
}
|
||||
|
||||
function require_single_event(option) {
|
||||
require_input_field("#single_event_date", option);
|
||||
set_disabled_status("#single_event_date", !option);
|
||||
}
|
||||
|
||||
function require_recurrent_event(option) {
|
||||
$("#recurrent_event_month").prop('required', option);
|
||||
set_disabled_status("#recurrent_event_month", !option);
|
||||
}
|
||||
|
||||
function require_lunch(option) {
|
||||
$("#lunch_start").prop('required', option);
|
||||
$("#lunch_finish").prop('required', option);
|
||||
|
|
@ -175,7 +157,7 @@ function require_lunch(option) {
|
|||
if (lunchFinishObj.value === "") {
|
||||
lunchFinishObj.value = "13:30";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lunchStartObj.value = "";
|
||||
lunchFinishObj.value = "";
|
||||
|
|
@ -246,11 +228,6 @@ function on_ventilation_type_change() {
|
|||
}
|
||||
|
||||
/* -------UI------- */
|
||||
$(function () {
|
||||
$(".datepicker").datepicker({
|
||||
dateFormat: 'dd/mm/yy'
|
||||
});
|
||||
});
|
||||
|
||||
function show_disclaimer() {
|
||||
var dots = document.getElementById("dots");
|
||||
|
|
@ -332,12 +309,6 @@ function validate_form(form) {
|
|||
}
|
||||
});
|
||||
|
||||
//Validate all dates
|
||||
$("input[required].datepicker").each(function() {
|
||||
if (!validateDate(this)) {
|
||||
submit = false;
|
||||
}
|
||||
});
|
||||
|
||||
//Validate window venting duration < venting frequency
|
||||
if (!$("#windows_duration").hasClass("disabled")) {
|
||||
|
|
@ -368,7 +339,7 @@ function validateValue(obj) {
|
|||
|
||||
function isLessThanZeroOrEmpty(value) {
|
||||
if (value === "") return true;
|
||||
if (value <= 0)
|
||||
if (value <= 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -488,10 +459,6 @@ $(document).ready(function () {
|
|||
$("input[required].non_zero").each(function() {validateValue(this)});
|
||||
$(".non_zero").change(function() {validateValue(this)});
|
||||
|
||||
//Validate all dates
|
||||
$("input[required].datepicker").each(function() {validateDate(this)});
|
||||
$(".datepicker").change(function() {validateDate(this)});
|
||||
|
||||
//Validate all finish times
|
||||
$("input[required].finish_time").each(function() {validateFinishTime(this)});
|
||||
$(".finish_time").change(function() {validateFinishTime(this)});
|
||||
|
|
@ -522,4 +489,4 @@ function objectifyForm(formArray) {
|
|||
for (var i = 0; i < formArray.length; i++)
|
||||
returnArray[formArray[i]['name']] = formArray[i]['value'];
|
||||
return returnArray;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "layout.html.j2" %}
|
||||
|
||||
{% set MODEL_VERSION="v1.2.0" %}
|
||||
{% set MODEL_VERSION="v1.2.1" %}
|
||||
{% set DEBUG=False %}
|
||||
{% set active_page="calculator/" %}
|
||||
|
||||
|
|
@ -80,19 +80,19 @@
|
|||
<div id="DIVnatural_ventilation" class="tabbed" style="display:none">
|
||||
Number of windows: <input type="number" id="windows_number" class="non_zero" name="windows_number" min="1"><br>
|
||||
Height of window: <input type="number" step="any" id="window_height" class="non_zero" name="window_height" placeholder="meters" min="0"><br>
|
||||
Window type:
|
||||
Window type:
|
||||
<input type="radio" id="window_sliding" name="window_type" value="sliding" onclick="require_fields(this)" checked="checked">
|
||||
<label for="window_sliding">Sliding / Side-Hung</label>
|
||||
<input type="radio" id="window_hinged" name="window_type" value="hinged" onclick="require_fields(this)">
|
||||
<label for="window_hinged">Top- or Bottom-Hung</label> <br>
|
||||
Width of window: <input type="number" step="any" id="window_width" class="non_zero disabled" name="window_width" placeholder="meters" min="0" data-has-radio="#window_hinged"><br>
|
||||
Opening distance: <input type="number" step="any" id="opening_distance" class="non_zero" name="opening_distance" placeholder="meters" min="0"><br>
|
||||
Windows open:</span><br>
|
||||
Windows open:</span><br>
|
||||
<span class="tabbed"><input type="radio" id="always" name="windows_open" value="always" onclick="require_fields(this)" checked="checked"></span>
|
||||
<label for="always">Permanently</label><br>
|
||||
<span class="tabbed"><input type="radio" id="interval" name="windows_open" value="interval" onclick="require_fields(this)"></span>
|
||||
<label for="interval">Periodically:</label>
|
||||
<input type="number" step="any" id="windows_duration" class="disabled" name="windows_duration" placeholder="Duration (min)" min="1" data-has-radio="#interval"> /
|
||||
<input type="number" step="any" id="windows_duration" class="disabled" name="windows_duration" placeholder="Duration (min)" min="1" data-has-radio="#interval"> /
|
||||
<input type="number" step="any" id="windows_frequency" class="disabled" name="windows_frequency" placeholder="Frequency (min)" min="1" data-has-radio="#interval">
|
||||
<br>
|
||||
</div>
|
||||
|
|
@ -151,17 +151,8 @@
|
|||
Finish: <input type="time" id="infected_finish" class="finish_time" data-time-group="infected" name="infected_finish" value="18:00" required><br>
|
||||
<hr width="80%">
|
||||
|
||||
When is the event?
|
||||
<div data-tooltip="Select the date for one-off events or the month if the event is recurrent in the same space.">
|
||||
<span class="tooltip_text">?</span>
|
||||
</div><br>
|
||||
<input type="radio" id="event_type_single" name="event_type" value="single_event" onclick="require_fields(this)" tabindex="-1" required>
|
||||
<label for="event_type_single">Single event</label>
|
||||
<label for="event_type_single">Date: </label>
|
||||
<input type="text" id="single_event_date" class="datepicker" name="single_event_date" placeholder="dd/mm/yyyy" data-has-radio="#event_type_single"><br>
|
||||
<input type="radio" id="event_type_recurrent" name="event_type" value="recurrent_event" onclick="require_fields(this)" tabindex="-1" required>
|
||||
<label for="event_type_recurrent">Recurrent usage</label>
|
||||
<select id="recurrent_event_month" name="recurrent_event_month" data-has-radio="#event_type_recurrent">
|
||||
<label>Which month is the event?</label>
|
||||
<select id="event_month" name="event_month" value="January" required>
|
||||
<option value="January">January</option>
|
||||
<option value="February">February</option>
|
||||
<option value="March">March</option>
|
||||
|
|
|
|||
|
|
@ -123,12 +123,7 @@
|
|||
<ul>
|
||||
<li><p class="data_subtext">Start time: {{ form.infected_start | minutes_to_time }}    End time: {{ form.infected_finish | minutes_to_time }}</p></li>
|
||||
</ul>
|
||||
{% if form.event_type == "single_event"%}
|
||||
<li><p class="data_text">Single event on {{ form.single_event_date }}</p></li>
|
||||
{% endif %}
|
||||
{% if form.event_type == "recurrent_event"%}
|
||||
<li><p class="data_text">Recurrent event for the month of {{ form.recurrent_event_month }}</p></li>
|
||||
{% endif %}
|
||||
<li><p class="data_text">Event for the month of {{ form.event_month }}</p></li>
|
||||
</ul>
|
||||
|
||||
<p class="data_title">Break data:</p>
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ def test_ventilation_slidingwindow(baseline_form):
|
|||
baseline_form.windows_frequency = 120
|
||||
baseline_form.windows_open = 'interval'
|
||||
baseline_form.window_type = 'sliding'
|
||||
baseline_form.event_type = 'recurrent_event'
|
||||
baseline_form.recurrent_event_month = 'December'
|
||||
baseline_form.event_month = 'December'
|
||||
baseline_form.window_height = 1.6
|
||||
baseline_form.opening_distance = 0.6
|
||||
|
||||
|
|
@ -65,8 +64,7 @@ def test_ventilation_hingedwindow(baseline_form):
|
|||
baseline_form.windows_frequency = 120
|
||||
baseline_form.windows_open = 'interval'
|
||||
baseline_form.window_type = 'hinged'
|
||||
baseline_form.event_type = 'recurrent_event'
|
||||
baseline_form.recurrent_event_month = 'December'
|
||||
baseline_form.event_month = 'December'
|
||||
baseline_form.window_height = 1.6
|
||||
baseline_form.window_width = 1.
|
||||
baseline_form.opening_distance = 0.6
|
||||
|
|
@ -124,8 +122,7 @@ def test_ventilation_window_hepa(baseline_form):
|
|||
baseline_form.windows_duration = 10
|
||||
baseline_form.windows_frequency = 120
|
||||
baseline_form.windows_open = 'interval'
|
||||
baseline_form.event_type = 'recurrent_event'
|
||||
baseline_form.recurrent_event_month = 'December'
|
||||
baseline_form.event_month = 'December'
|
||||
baseline_form.window_height = 1.6
|
||||
baseline_form.opening_distance = 0.6
|
||||
baseline_form.hepa_option = True
|
||||
|
|
|
|||
Loading…
Reference in a new issue