emvecchi commited on
Commit
302cefa
1 Parent(s): ae24278

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -239,6 +239,26 @@ def show_field(f: Field, index: int):
239
 
240
 
241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
 
243
  st.set_page_config(layout='wide')
244
  # Title of the app
 
239
 
240
 
241
 
242
+ def show_fields(fields: List[Field]):
243
+ index = st.session_state.current_index
244
+ data_collected = read_saved_data()
245
+ st.session_state.default_values = {}
246
+ st.session_state.data_inputs = {}
247
+
248
+ for field in fields:
249
+ show_field(field, index, data_collected)
250
+
251
+ submitted = st.form_submit_button("Submit")
252
+ if submitted:
253
+ with st.spinner(text="saving"):
254
+ save_data({
255
+ 'user_id': st.session_state.user_id,
256
+ 'index': st.session_state.current_index,
257
+ **(st.session_state.data.iloc[index][COLS_TO_SAVE].to_dict() if index >= 0 else {}),
258
+ **st.session_state.data_inputs
259
+ })
260
+ st.success("Feedback submitted successfully!")
261
+ navigate(1)
262
 
263
  st.set_page_config(layout='wide')
264
  # Title of the app