CarlyneB commited on
Commit
27be152
·
1 Parent(s): adf4d9f

[FIX] When a new resource row has min == max, it now displays the value as a fixed label instead of trying to render a slider.

Browse files
Files changed (1) hide show
  1. tabs/tab3_coefficients.py +8 -1
tabs/tab3_coefficients.py CHANGED
@@ -171,7 +171,6 @@ def render_standard_resource_row(method, r, conf, display_label, enabled_methods
171
  slider_key = f"slider_{method}_{r}".replace(" ", "_").lower()
172
  manual_key = f"manual_{method}_{r}".replace(" ", "_").lower()
173
  current_val = normalize_costs(st.session_state.costs.get(method, {})).get(r, 0.0)
174
-
175
  if is_secondary:
176
  if toggle_key not in st.session_state:
177
  st.session_state[toggle_key] = current_val != 0.0
@@ -276,6 +275,14 @@ def render_custom_resource_row(method, r, conf, enabled_methods, custom_resource
276
  st.session_state.costs.setdefault(method, {})[r] = conf["median"]
277
  current_val = conf["median"]
278
 
 
 
 
 
 
 
 
 
279
  if slider_key not in st.session_state:
280
  st.session_state[slider_key] = current_val
281
  if manual_key not in st.session_state:
 
171
  slider_key = f"slider_{method}_{r}".replace(" ", "_").lower()
172
  manual_key = f"manual_{method}_{r}".replace(" ", "_").lower()
173
  current_val = normalize_costs(st.session_state.costs.get(method, {})).get(r, 0.0)
 
174
  if is_secondary:
175
  if toggle_key not in st.session_state:
176
  st.session_state[toggle_key] = current_val != 0.0
 
275
  st.session_state.costs.setdefault(method, {})[r] = conf["median"]
276
  current_val = conf["median"]
277
 
278
+ if conf["min"] == conf["max"]:
279
+ st.markdown(
280
+ f'<p class="crra-resource-name">{r} = <strong>{conf["median"]}</strong> (fixed)</p>',
281
+ unsafe_allow_html=True,
282
+ )
283
+ st.session_state.costs.setdefault(method, {})[r] = conf["median"]
284
+ return
285
+
286
  if slider_key not in st.session_state:
287
  st.session_state[slider_key] = current_val
288
  if manual_key not in st.session_state: