Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,46 +78,52 @@
html.Label(["Room Volume", "\u00A0", "m", html.Sup("3")]),
html.Br(),
dcc.Input(
type="text",
type="number",
placeholder="30",
id="input_room_volume",
className="custom-input", # Use custom style class
min=0,
),
html.Br(),
html.Label(["Room Height", "\u00A0", "m"]),
html.Br(),
dcc.Input(
type="text",
type="number",
# placeholder="3",
id="input_room_height",
className="custom-input", # Use custom style class
min=0,
),
html.Br(),
html.Label(["Temperature", "\u00A0", "°C"]),
html.Br(),
dcc.Input(
type="text",
type="number",
placeholder="20",
id="input_room_temperature",
className="custom-input", # Use custom style class
min=-273.15,
),
html.Br(),
html.Label(["Relative Humidity","\u00A0", "%"]),
html.Br(),
dcc.Input(
type="text",
type="number",
placeholder="50",
id="input_room_humidity",
className="custom-input", # Use custom style class
min=0,
max=100,
),
html.Br(),
html.Label(["Air Pressure", "\u00A0", "hPa"]),
html.Br(),
dcc.Input(
type="text",
type="number",
placeholder="1013.5",
id="input_room_pressure",
className="custom-input", # Use custom style class
min=0,
),
html.Br(),
html.Label("Room Usage Type"),
Expand Down Expand Up @@ -479,12 +485,10 @@ def update_area_table_with_material(active_cell, material_data, active_row_index
State('input_room_volume', 'value')
)
def round_room_volume(n_blur, value):
if value is None or value == '':
if value is None:
return None
try:
# Replace comma with dot and convert to float
num_value = float(str(value).replace(',', '.'))
return round(num_value, 2)
return round(float(value), 2)
except (ValueError, TypeError):
return None

Expand All @@ -494,11 +498,10 @@ def round_room_volume(n_blur, value):
State('input_room_height', 'value')
)
def round_room_height(n_blur, value):
if value is None or value == '':
if value is None:
return None
try:
num_value = float(str(value).replace(',', '.'))
return round(num_value, 2)
return round(float(value), 2)
except (ValueError, TypeError):
return None

Expand All @@ -508,11 +511,10 @@ def round_room_height(n_blur, value):
State('input_room_temperature', 'value')
)
def round_room_temperature(n_blur, value):
if value is None or value == '':
if value is None:
return None
try:
num_value = float(str(value).replace(',', '.'))
return round(num_value, 2)
return round(float(value), 2)
except (ValueError, TypeError):
return None

Expand All @@ -522,11 +524,10 @@ def round_room_temperature(n_blur, value):
State('input_room_humidity', 'value')
)
def round_room_humidity(n_blur, value):
if value is None or value == '':
if value is None:
return None
try:
num_value = float(str(value).replace(',', '.'))
return round(num_value, 2)
return round(float(value), 2)
except (ValueError, TypeError):
return None

Expand All @@ -536,11 +537,10 @@ def round_room_humidity(n_blur, value):
State('input_room_pressure', 'value')
)
def round_room_pressure(n_blur, value):
if value is None or value == '':
if value is None:
return None
try:
num_value = float(str(value).replace(',', '.'))
return round(num_value, 2)
return round(float(value), 2)
except (ValueError, TypeError):
return None

Expand Down