James McCool
commited on
Commit
·
f939d56
1
Parent(s):
15e1050
Enhance pricing source handling in Data Load tab
Browse filesAdded session state management for tracking whether the pricing data has been loaded. This change ensures that the application correctly processes the uploaded CSV file based on the selected pricing source, improving data handling and user experience.
app.py
CHANGED
|
@@ -600,6 +600,7 @@ if selected_tab == 'Data Load':
|
|
| 600 |
st.info("Upload the player pricing CSV from the site you are playing on")
|
| 601 |
|
| 602 |
pricing_source = st.selectbox("Select a pricing source", options=['Paydirt DB', 'User Upload'])
|
|
|
|
| 603 |
|
| 604 |
upload_csv_col, csv_template_col = st.columns([3, 1])
|
| 605 |
if pricing_source == 'Paydirt DB':
|
|
@@ -625,12 +626,13 @@ if selected_tab == 'Data Load':
|
|
| 625 |
mime="text/csv"
|
| 626 |
)
|
| 627 |
st.session_state['csv_file'] = load_csv(csv_file)
|
|
|
|
| 628 |
try:
|
| 629 |
st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)
|
| 630 |
except:
|
| 631 |
pass
|
| 632 |
|
| 633 |
-
if
|
| 634 |
if type_var == 'Showdown':
|
| 635 |
st.session_state['csv_file']['Position'] = 'FLEX'
|
| 636 |
else:
|
|
|
|
| 600 |
st.info("Upload the player pricing CSV from the site you are playing on")
|
| 601 |
|
| 602 |
pricing_source = st.selectbox("Select a pricing source", options=['Paydirt DB', 'User Upload'])
|
| 603 |
+
st.session_state['pricing_loaded'] = False
|
| 604 |
|
| 605 |
upload_csv_col, csv_template_col = st.columns([3, 1])
|
| 606 |
if pricing_source == 'Paydirt DB':
|
|
|
|
| 626 |
mime="text/csv"
|
| 627 |
)
|
| 628 |
st.session_state['csv_file'] = load_csv(csv_file)
|
| 629 |
+
st.session_state['pricing_loaded'] = True
|
| 630 |
try:
|
| 631 |
st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)
|
| 632 |
except:
|
| 633 |
pass
|
| 634 |
|
| 635 |
+
if st.session_state['pricing_loaded']:
|
| 636 |
if type_var == 'Showdown':
|
| 637 |
st.session_state['csv_file']['Position'] = 'FLEX'
|
| 638 |
else:
|