Access location in model_generator and report

This commit is contained in:
gaazzopa 2021-07-14 11:26:13 +02:00 committed by jdevine
parent de4e59b9c0
commit e88a93ec1c
4 changed files with 14 additions and 1 deletions

View file

@ -50,6 +50,7 @@ class FormData:
infected_lunch_start: minutes_since_midnight #Used if infected_dont_have_breaks_with_exposed
infected_people: int
infected_start: minutes_since_midnight
location: str
mask_type: str
mask_wearing_option: str
mechanical_ventilation_type: str
@ -100,6 +101,7 @@ class FormData:
'infected_lunch_start': '12:30',
'infected_people': _NO_DEFAULT,
'infected_start': '08:30',
'location': _NO_DEFAULT,
'mask_type': 'Type I',
'mask_wearing_option': 'mask_off',
'mechanical_ventilation_type': 'not-applicable',
@ -601,6 +603,7 @@ def baseline_raw_form_data():
'infected_lunch_start': '12:30',
'infected_people': '1',
'infected_start': '09:00',
'location': 'Geneva',
'mask_type': 'Type I',
'mask_wearing_option': 'mask_off',
'mechanical_ventilation_type': '',

View file

@ -484,6 +484,15 @@ $(document).ready(function () {
else if (elemObj.type === 'checkbox') {
elemObj.checked = (value==1);
}
//Pre-select location
else if (elemObj.id === 'location_select') {
var location_option = document.createElement('option');
location_option.value = value;
location_option.innerHTML = value;
elemObj.append(location_option);
}
//Ignore 0 (default) values from server side
else if (!(elemObj.classList.contains("non_zero") || elemObj.classList.contains("remove_zero")) || (value != "0.0" && value != "0")) {
elemObj.value = value;

View file

@ -53,6 +53,7 @@
</p></li>
<li><p class="data_text">Room Volume: {{ model.concentration_model.room.volume }} m³</p></li>
<li><p class="data_text">Room Central Heating: {{ "On" if form.room_heating_option else "Off" }}</p></li>
<li><p class="data_text">Room Location: {{ form.location }}</p></li>
</ul>
<p class="data_title">Ventilation data:</p>

View file

@ -108,7 +108,7 @@ v{{ calculator_version }} <span style="float:right; font-weight:bold">Please sen
<div class="row">
<label class="col-xl-3 col-lg-4 col-sm-3 col-form-label">Location:</label>
<select id="location_select" class="col-xl-5 col-lg-7 col-sm-7 col-7" name="location" required>
<!-- <option value="Geneva" selected="selected">Geneva</option> -->
</select>
</div>