James McCool commited on
Commit
8c3816f
·
1 Parent(s): 7a4934e

Refactor download button for contest info in app.py to unify key

Browse files

- Consolidated the download button for contest information by using a single unique key, streamlining the code and enhancing the user experience when exporting contest data as a CSV file.

Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -8,7 +8,6 @@ from pymongo.mongo_client import MongoClient
8
  from pymongo.server_api import ServerApi
9
  from datetime import datetime
10
 
11
-
12
  # Just setting a note here to say that I should attempt to do some memory allocation savings and swap to numpy soon
13
 
14
  def init_conn():
@@ -442,10 +441,9 @@ with tab2:
442
  use_container_width=True,
443
  hide_index=True
444
  )
445
- st.download_button(label="Download Contest Info", data=st.session_state['display_contest_info'].to_csv(index=False), file_name="contest_info.csv", mime="text/csv", key='download_contest_1')
446
  else:
447
  st.stop()
448
- st.download_button(label="Download Contest Info", data=st.session_state['display_contest_info'].to_csv(index=False), file_name="contest_info.csv", mime="text/csv", key='download_contest_2')
449
  if 'Contest' in st.session_state:
450
  with st.container():
451
  tab1, tab2, tab3, tab4, tab5 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info', 'Duplication Info'])
 
8
  from pymongo.server_api import ServerApi
9
  from datetime import datetime
10
 
 
11
  # Just setting a note here to say that I should attempt to do some memory allocation savings and swap to numpy soon
12
 
13
  def init_conn():
 
441
  use_container_width=True,
442
  hide_index=True
443
  )
 
444
  else:
445
  st.stop()
446
+ st.download_button(label="Download Contest Info", data=st.session_state['display_contest_info'].to_csv(index=False), file_name="contest_info.csv", mime="text/csv", key='download_contest')
447
  if 'Contest' in st.session_state:
448
  with st.container():
449
  tab1, tab2, tab3, tab4, tab5 = st.tabs(['Player Used Info', 'Stack Used Info', 'Stack Size Info', 'General Info', 'Duplication Info'])