Spaces:
Sleeping
Sleeping
Jon Solow
commited on
Commit
·
577d253
1
Parent(s):
3b2782b
Add cap of 3 players and effective cost if same round selected
Browse files- src/pages/2_My_Keepers.py +19 -10
src/pages/2_My_Keepers.py
CHANGED
@@ -74,16 +74,25 @@ def get_page():
|
|
74 |
)
|
75 |
st.header("Add Keeper")
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
st.header("Options")
|
88 |
if st.checkbox("Show all my options"):
|
89 |
st.dataframe(
|
|
|
74 |
)
|
75 |
st.header("Add Keeper")
|
76 |
|
77 |
+
if len(selected_keeper_cost_map) >= 3:
|
78 |
+
st.warning(
|
79 |
+
"You have selected your maximum of 3 keepers. Please remove a player if you wish to add another."
|
80 |
+
)
|
81 |
+
else:
|
82 |
+
|
83 |
+
selection = st.selectbox(
|
84 |
+
"Add Keeper",
|
85 |
+
data_user[~data_user.player_id.isin(selected_keeper_cost_map.keys())].to_dict(orient="records"),
|
86 |
+
format_func=lambda x: f"{x['name']} - {x['keeper_cost']}",
|
87 |
+
index=None,
|
88 |
+
)
|
89 |
+
if selection:
|
90 |
+
if st.button("Add Selection"):
|
91 |
+
effective_cost = selection["keeper_cost"]
|
92 |
+
while effective_cost in selected_keeper_cost_map.values():
|
93 |
+
effective_cost -= 1
|
94 |
+
select_keeper(selection["player_id"], selection["manager_guid"], effective_cost)
|
95 |
+
st.rerun()
|
96 |
st.header("Options")
|
97 |
if st.checkbox("Show all my options"):
|
98 |
st.dataframe(
|