Spaces:
Runtime error
Runtime error
Jakub commited on
Commit ·
2e0a6b2
1
Parent(s): 0c971d1
Fix missing decimal separator in streamlit ui
Browse files- src/table_comparator/app.py +29 -0
src/table_comparator/app.py
CHANGED
|
@@ -142,6 +142,8 @@ def main() -> None: # noqa: C901 – kept as single function for Streamlit flow
|
|
| 142 |
fmt_a = fmt_b = None
|
| 143 |
rounding = None
|
| 144 |
case_sensitive = True
|
|
|
|
|
|
|
| 145 |
|
| 146 |
if col_type == "date":
|
| 147 |
dc1, dc2 = st.columns(2)
|
|
@@ -154,6 +156,7 @@ def main() -> None: # noqa: C901 – kept as single function for Streamlit flow
|
|
| 154 |
form_ok = False
|
| 155 |
|
| 156 |
elif col_type == "number":
|
|
|
|
| 157 |
nc1, nc2 = st.columns(2)
|
| 158 |
with nc1:
|
| 159 |
do_round = st.toggle("Apply rounding", key=f"rt_{i}")
|
|
@@ -165,6 +168,30 @@ def main() -> None: # noqa: C901 – kept as single function for Streamlit flow
|
|
| 165 |
key=f"rd_{i}",
|
| 166 |
)
|
| 167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
elif col_type == "text":
|
| 169 |
case_sensitive = st.toggle(
|
| 170 |
"Case sensitive", value=True, key=f"cs_{i}"
|
|
@@ -179,6 +206,8 @@ def main() -> None: # noqa: C901 – kept as single function for Streamlit flow
|
|
| 179 |
date_format_b=fmt_b,
|
| 180 |
rounding=rounding,
|
| 181 |
case_sensitive=case_sensitive,
|
|
|
|
|
|
|
| 182 |
)
|
| 183 |
)
|
| 184 |
|
|
|
|
| 142 |
fmt_a = fmt_b = None
|
| 143 |
rounding = None
|
| 144 |
case_sensitive = True
|
| 145 |
+
decimal_sep_a = "."
|
| 146 |
+
decimal_sep_b = "."
|
| 147 |
|
| 148 |
if col_type == "date":
|
| 149 |
dc1, dc2 = st.columns(2)
|
|
|
|
| 156 |
form_ok = False
|
| 157 |
|
| 158 |
elif col_type == "number":
|
| 159 |
+
# Rounding controls
|
| 160 |
nc1, nc2 = st.columns(2)
|
| 161 |
with nc1:
|
| 162 |
do_round = st.toggle("Apply rounding", key=f"rt_{i}")
|
|
|
|
| 168 |
key=f"rd_{i}",
|
| 169 |
)
|
| 170 |
|
| 171 |
+
# Decimal separator controls
|
| 172 |
+
st.caption(
|
| 173 |
+
"Decimal separator: Specify which character is used as the "
|
| 174 |
+
"decimal point (e.g., '.' for US format like 1,234.56 or ',' "
|
| 175 |
+
"for European format like 1.234,56)"
|
| 176 |
+
)
|
| 177 |
+
ds1, ds2 = st.columns(2)
|
| 178 |
+
with ds1:
|
| 179 |
+
decimal_sep_a = st.selectbox(
|
| 180 |
+
"Decimal separator A",
|
| 181 |
+
options=[".", ","],
|
| 182 |
+
index=0,
|
| 183 |
+
key=f"dsa_{i}",
|
| 184 |
+
help="Decimal separator for Table A (default: '.' for US/UK format)"
|
| 185 |
+
)
|
| 186 |
+
with ds2:
|
| 187 |
+
decimal_sep_b = st.selectbox(
|
| 188 |
+
"Decimal separator B",
|
| 189 |
+
options=[".", ","],
|
| 190 |
+
index=0,
|
| 191 |
+
key=f"dsb_{i}",
|
| 192 |
+
help="Decimal separator for Table B (default: '.' for US/UK format)"
|
| 193 |
+
)
|
| 194 |
+
|
| 195 |
elif col_type == "text":
|
| 196 |
case_sensitive = st.toggle(
|
| 197 |
"Case sensitive", value=True, key=f"cs_{i}"
|
|
|
|
| 206 |
date_format_b=fmt_b,
|
| 207 |
rounding=rounding,
|
| 208 |
case_sensitive=case_sensitive,
|
| 209 |
+
decimal_separator_a=decimal_sep_a,
|
| 210 |
+
decimal_separator_b=decimal_sep_b,
|
| 211 |
)
|
| 212 |
)
|
| 213 |
|