James McCool
commited on
Commit
·
5404e76
1
Parent(s):
371a9aa
Update app.py to utilize session state for trimming dictionary max values: enhance state management by ensuring consistent access to ownership type thresholds during portfolio updates.
Browse files
app.py
CHANGED
@@ -884,7 +884,7 @@ with tab2:
|
|
884 |
col1, col2 = st.columns([2, 8])
|
885 |
with col1:
|
886 |
if 'trimming_dict_maxes' not in st.session_state:
|
887 |
-
trimming_dict_maxes = {
|
888 |
'Own': 500.0,
|
889 |
'Geomean': 500.0,
|
890 |
'Weighted Own': 500.0,
|
@@ -931,14 +931,14 @@ with tab2:
|
|
931 |
with min_sort:
|
932 |
performance_threshold_low = st.number_input("Min", value=0.0, min_value=0.0, step=1.0, key='min_sort')
|
933 |
with max_sort:
|
934 |
-
performance_threshold_high = st.number_input("Max", value=trimming_dict_maxes[performance_type], min_value=0.0, step=1.0, key='max_sort')
|
935 |
|
936 |
st.write("Trimming threshold range:")
|
937 |
min_trim, max_trim = st.columns(2)
|
938 |
with min_trim:
|
939 |
own_threshold_low = st.number_input("Min", value=0.0, min_value=0.0, step=1.0, key='min_trim')
|
940 |
with max_trim:
|
941 |
-
own_threshold_high = st.number_input("Max", value=trimming_dict_maxes[own_type], min_value=0.0, step=1.0, key='max_trim')
|
942 |
|
943 |
submitted = st.form_submit_button("Trim")
|
944 |
if submitted:
|
|
|
884 |
col1, col2 = st.columns([2, 8])
|
885 |
with col1:
|
886 |
if 'trimming_dict_maxes' not in st.session_state:
|
887 |
+
st.session_state['trimming_dict_maxes'] = {
|
888 |
'Own': 500.0,
|
889 |
'Geomean': 500.0,
|
890 |
'Weighted Own': 500.0,
|
|
|
931 |
with min_sort:
|
932 |
performance_threshold_low = st.number_input("Min", value=0.0, min_value=0.0, step=1.0, key='min_sort')
|
933 |
with max_sort:
|
934 |
+
performance_threshold_high = st.number_input("Max", value=st.session_state['trimming_dict_maxes'][performance_type], min_value=0.0, step=1.0, key='max_sort')
|
935 |
|
936 |
st.write("Trimming threshold range:")
|
937 |
min_trim, max_trim = st.columns(2)
|
938 |
with min_trim:
|
939 |
own_threshold_low = st.number_input("Min", value=0.0, min_value=0.0, step=1.0, key='min_trim')
|
940 |
with max_trim:
|
941 |
+
own_threshold_high = st.number_input("Max", value=st.session_state['trimming_dict_maxes'][own_type], min_value=0.0, step=1.0, key='max_trim')
|
942 |
|
943 |
submitted = st.form_submit_button("Trim")
|
944 |
if submitted:
|