diff --git a/cara/apps/calculator/README.md b/cara/apps/calculator/README.md index acb57c3c..9de5cdc4 100644 --- a/cara/apps/calculator/README.md +++ b/cara/apps/calculator/README.md @@ -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. diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py index 365ba4dc..998f0a13 100644 --- a/cara/apps/calculator/model_generator.py +++ b/cara/apps/calculator/model_generator.py @@ -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'} diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js index 4770ed8d..3f9c7557 100644 --- a/cara/apps/calculator/static/js/form.js +++ b/cara/apps/calculator/static/js/form.js @@ -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; -} \ No newline at end of file +} diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2 index 80bc3ef2..7ea8b75c 100644 --- a/cara/apps/calculator/templates/calculator.form.html.j2 +++ b/cara/apps/calculator/templates/calculator.form.html.j2 @@ -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 @@
@@ -151,17 +151,8 @@ Finish: