James McCool
commited on
Commit
·
c08b1bb
1
Parent(s):
f0f14d1
Update init_nfl_baselines function to handle slate variable mapping
Browse filesRefactored the init_nfl_baselines function to map user-defined slate variables to their corresponding display names. This change ensures consistency in slate handling across the application and improves the loading logic in the Data Load tab by utilizing the updated slate variable.
- app.py +1 -1
- database_queries.py +7 -0
app.py
CHANGED
|
@@ -700,7 +700,7 @@ if selected_tab == 'Data Load':
|
|
| 700 |
st.session_state['projections_loaded'] = True
|
| 701 |
elif proj_options == 'Paydirt DB':
|
| 702 |
if st.button("Load from Database"):
|
| 703 |
-
projections_file = init_nfl_baselines(type_var, site_var,
|
| 704 |
st.session_state['db_projections_file'] = projections_file
|
| 705 |
st.session_state['projections_loaded'] = True
|
| 706 |
if 'projections_df' in st.session_state:
|
|
|
|
| 700 |
st.session_state['projections_loaded'] = True
|
| 701 |
elif proj_options == 'Paydirt DB':
|
| 702 |
if st.button("Load from Database"):
|
| 703 |
+
projections_file = init_nfl_baselines(type_var, site_var, slate_var3)[0]
|
| 704 |
st.session_state['db_projections_file'] = projections_file
|
| 705 |
st.session_state['projections_loaded'] = True
|
| 706 |
if 'projections_df' in st.session_state:
|
database_queries.py
CHANGED
|
@@ -59,6 +59,13 @@ except:
|
|
| 59 |
|
| 60 |
def init_nfl_baselines(type_var: str, site_var: str, slate_var: str):
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
if type_var == 'Classic':
|
| 63 |
collection = nfl_db["DK_NFL_ROO"]
|
| 64 |
cursor = collection.find()
|
|
|
|
| 59 |
|
| 60 |
def init_nfl_baselines(type_var: str, site_var: str, slate_var: str):
|
| 61 |
|
| 62 |
+
if slate_var == 'Main':
|
| 63 |
+
slate_var = 'Main Slate'
|
| 64 |
+
elif slate_var == 'Secondary':
|
| 65 |
+
slate_var = 'Secondary Slate'
|
| 66 |
+
elif slate_var == 'Auxiliary':
|
| 67 |
+
slate_var = 'Late Slate'
|
| 68 |
+
|
| 69 |
if type_var == 'Classic':
|
| 70 |
collection = nfl_db["DK_NFL_ROO"]
|
| 71 |
cursor = collection.find()
|