James McCool
commited on
Commit
·
591ec4f
1
Parent(s):
cff79f7
Refactor return message handling in export_contest_file function in app.py
Browse files- Simplified the return messages for existing contest data and successful uploads by removing Streamlit's st.info and st.success calls, enhancing code clarity and maintainability.
- This change improves the readability of the feedback messages while maintaining user experience.
app.py
CHANGED
@@ -64,7 +64,7 @@ def export_contest_file(db, sport, type, contest_date, contest_id, contest_data)
|
|
64 |
cursor = collection.find()
|
65 |
contest_import = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
66 |
if contest_id in contest_import['Contest ID'].values:
|
67 |
-
return_message =
|
68 |
return return_message
|
69 |
except:
|
70 |
contest_import = pd.DataFrame(columns = ['Rank', 'EntryId', 'EntryName', 'TimeRemaining', 'Points', 'Lineup', 'Player', 'Roster Position', '%Drafted', 'FPTS', 'Contest Date', 'Contest ID'])
|
@@ -83,7 +83,7 @@ def export_contest_file(db, sport, type, contest_date, contest_id, contest_data)
|
|
83 |
break
|
84 |
except Exception as e:
|
85 |
print(f"Retry due to error: {e}")
|
86 |
-
return_message =
|
87 |
|
88 |
return return_message
|
89 |
|
|
|
64 |
cursor = collection.find()
|
65 |
contest_import = pd.DataFrame(list(cursor)).drop('_id', axis=1)
|
66 |
if contest_id in contest_import['Contest ID'].values:
|
67 |
+
return_message = "Data for this contest already exists, no need to upload, but we appreciate the effort!"
|
68 |
return return_message
|
69 |
except:
|
70 |
contest_import = pd.DataFrame(columns = ['Rank', 'EntryId', 'EntryName', 'TimeRemaining', 'Points', 'Lineup', 'Player', 'Roster Position', '%Drafted', 'FPTS', 'Contest Date', 'Contest ID'])
|
|
|
83 |
break
|
84 |
except Exception as e:
|
85 |
print(f"Retry due to error: {e}")
|
86 |
+
return_message = "Contest data uploaded successfully! We appreciate the data!"
|
87 |
|
88 |
return return_message
|
89 |
|