Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
cb46d4d
1
Parent(s):
0ff4b2c
Enhance FanDuel lineup initialization by adding database translation support for showdown slates and improving player name mapping, ensuring accurate data representation and retrieval.
Browse files- src/streamlit_app.py +9 -1
src/streamlit_app.py
CHANGED
|
@@ -339,7 +339,15 @@ def init_DK_lineups(type_var, slate_var, prio_var, prio_mix, db_translation):
|
|
| 339 |
return DK_seed
|
| 340 |
|
| 341 |
@st.cache_resource(ttl = 60)
|
| 342 |
-
def init_FD_lineups(type_var, slate_var, prio_var, prio_mix):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
|
| 344 |
if prio_var == 'Mix':
|
| 345 |
prio_var = None
|
|
|
|
| 339 |
return DK_seed
|
| 340 |
|
| 341 |
@st.cache_resource(ttl = 60)
|
| 342 |
+
def init_FD_lineups(type_var, slate_var, prio_var, prio_mix, db_translation):
|
| 343 |
+
|
| 344 |
+
if type_var == 'Showdown':
|
| 345 |
+
collection = db[db_translation[slate_var]]
|
| 346 |
+
cursor = collection.find()
|
| 347 |
+
raw_display = pd.DataFrame(list(cursor))
|
| 348 |
+
raw_display = raw_display[['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4', 'FLEX5', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
| 349 |
+
for column in ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4', 'FLEX5']:
|
| 350 |
+
raw_display[column] = raw_display[column].map(dict(zip(wrong_team_names, right_name_teams)), na_action='ignore').fillna(raw_display[column])
|
| 351 |
|
| 352 |
if prio_var == 'Mix':
|
| 353 |
prio_var = None
|