MarcosRodrigo commited on
Commit
7d45ee9
·
verified ·
1 Parent(s): f26219f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -23
app.py CHANGED
@@ -194,28 +194,6 @@ elif menu == "History":
194
  # pd.DataFrame(columns=["Name", "Drinks", "Food"]).to_csv(TEMP_FILE, index=False)
195
  # upload_temp_file_to_repo()
196
 
197
- # # "Current" view to display the current summary of all users' selections and submit to history
198
- # elif menu == "Current":
199
- # st.title("Current Selections of All Users")
200
- # if st.button("Reload Selections"):
201
- # download_temp_file_from_repo()
202
- # current_df = load_current_selections()
203
- # st.table(current_df)
204
-
205
- # if st.button("Submit Summary to History"):
206
- # timestamp = save_summary_to_history()
207
- # st.success(f"Summary saved to history at {timestamp}")
208
- # st.session_state.history = load_history()
209
-
210
- # # Clear local and remote current selections
211
- # if os.path.exists(TEMP_FILE):
212
- # os.remove(TEMP_FILE)
213
- # delete_file_from_repo(TEMP_FILE) # Delete the file from the remote repo
214
-
215
- # # Create an empty CSV to replace the deleted one
216
- # pd.DataFrame(columns=["Name", "Drinks", "Food"]).to_csv(TEMP_FILE, index=False)
217
- # upload_temp_file_to_repo()
218
-
219
  # "Current" view to display the current summary of all users' selections and generate ticket
220
  elif menu == "Current":
221
  st.title("Current Selections of All Users")
@@ -306,7 +284,7 @@ elif menu == "Current":
306
  timestamp = save_summary_to_history()
307
  st.success(f"Summary saved to history at {timestamp}")
308
  st.session_state.history = load_history()
309
-
310
  # Clear local and remote current selections
311
  if os.path.exists(TEMP_FILE):
312
  os.remove(TEMP_FILE)
@@ -316,6 +294,13 @@ elif menu == "Current":
316
  pd.DataFrame(columns=["Name", "Drinks", "Food"]).to_csv(TEMP_FILE, index=False)
317
  upload_temp_file_to_repo()
318
 
 
 
 
 
 
 
 
319
  # History view to check past summaries
320
  elif menu == "History":
321
  st.title("Breakfast Poll History")
 
194
  # pd.DataFrame(columns=["Name", "Drinks", "Food"]).to_csv(TEMP_FILE, index=False)
195
  # upload_temp_file_to_repo()
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  # "Current" view to display the current summary of all users' selections and generate ticket
198
  elif menu == "Current":
199
  st.title("Current Selections of All Users")
 
284
  timestamp = save_summary_to_history()
285
  st.success(f"Summary saved to history at {timestamp}")
286
  st.session_state.history = load_history()
287
+
288
  # Clear local and remote current selections
289
  if os.path.exists(TEMP_FILE):
290
  os.remove(TEMP_FILE)
 
294
  pd.DataFrame(columns=["Name", "Drinks", "Food"]).to_csv(TEMP_FILE, index=False)
295
  upload_temp_file_to_repo()
296
 
297
+ # Reset session state for current selections
298
+ st.session_state.current_selections = []
299
+
300
+ # Reload the current selections to show an empty table
301
+ current_df = pd.DataFrame(columns=["Name", "Drinks", "Food"])
302
+ st.table(current_df)
303
+
304
  # History view to check past summaries
305
  elif menu == "History":
306
  st.title("Breakfast Poll History")