Spaces:
Build error
Build error
James McCool commited on
Commit ·
b0f0d19
1
Parent(s): e42f4a5
Fixing a None error in contest ID selection
Browse files
app.py
CHANGED
|
@@ -1493,16 +1493,22 @@ if selected_tab == 'Data Load':
|
|
| 1493 |
f"{c['contest_name']} | {c.get('game_type', '')} | ${int(c.get('prize_pool', 0)):,.0f}"
|
| 1494 |
for c in contest_options
|
| 1495 |
]
|
|
|
|
| 1496 |
selected_label = st.selectbox(
|
| 1497 |
"Select Contest (searchable)",
|
| 1498 |
-
options=
|
| 1499 |
key="selected_pricing_contest",
|
| 1500 |
help="Type to search contest names."
|
| 1501 |
)
|
| 1502 |
-
|
| 1503 |
-
|
|
|
|
|
|
|
| 1504 |
|
| 1505 |
if st.button("Load Selected Contest Pricing", key="load_selected_contest_pricing"):
|
|
|
|
|
|
|
|
|
|
| 1506 |
try:
|
| 1507 |
pricing_df = fetch_pricing_for_contest(selected_contest['contest_id'])
|
| 1508 |
st.session_state['csv_file'] = load_csv(pricing_df)
|
|
|
|
| 1493 |
f"{c['contest_name']} | {c.get('game_type', '')} | ${int(c.get('prize_pool', 0)):,.0f}"
|
| 1494 |
for c in contest_options
|
| 1495 |
]
|
| 1496 |
+
contest_dropdown_options = ["None"] + contest_labels
|
| 1497 |
selected_label = st.selectbox(
|
| 1498 |
"Select Contest (searchable)",
|
| 1499 |
+
options=contest_dropdown_options,
|
| 1500 |
key="selected_pricing_contest",
|
| 1501 |
help="Type to search contest names."
|
| 1502 |
)
|
| 1503 |
+
selected_contest = None
|
| 1504 |
+
if selected_label != "None":
|
| 1505 |
+
selected_idx = contest_labels.index(selected_label)
|
| 1506 |
+
selected_contest = contest_options[selected_idx]
|
| 1507 |
|
| 1508 |
if st.button("Load Selected Contest Pricing", key="load_selected_contest_pricing"):
|
| 1509 |
+
if selected_contest is None:
|
| 1510 |
+
st.warning("Select a contest before loading pricing.")
|
| 1511 |
+
st.stop()
|
| 1512 |
try:
|
| 1513 |
pricing_df = fetch_pricing_for_contest(selected_contest['contest_id'])
|
| 1514 |
st.session_state['csv_file'] = load_csv(pricing_df)
|