Spaces:
Sleeping
Sleeping
Ashmi Banerjee
commited on
Commit
·
8c97b83
1
Parent(s):
0cc4451
potential bug fix
Browse files- views/continue_survey.py +2 -1
- views/nav_buttons.py +4 -1
- views/questions_screen.py +1 -0
views/continue_survey.py
CHANGED
@@ -34,7 +34,8 @@ def continue_survey_screen(data):
|
|
34 |
# Set session state values based on saved progress
|
35 |
st.session_state.current_index = saved_state.get("current_index", 0)
|
36 |
st.session_state.responses = saved_state.get("responses", [])
|
37 |
-
|
|
|
38 |
# Find the last answered config_id in responses
|
39 |
last_config_id = None
|
40 |
if st.session_state.responses:
|
|
|
34 |
# Set session state values based on saved progress
|
35 |
st.session_state.current_index = saved_state.get("current_index", 0)
|
36 |
st.session_state.responses = saved_state.get("responses", [])
|
37 |
+
if len(st.session_state.responses) == len(data):
|
38 |
+
st.session_state.completed = True
|
39 |
# Find the last answered config_id in responses
|
40 |
last_config_id = None
|
41 |
if st.session_state.responses:
|
views/nav_buttons.py
CHANGED
@@ -68,4 +68,7 @@ def navigation_buttons(data, response: Response):
|
|
68 |
|
69 |
with col3: # Save & Resume Later button
|
70 |
if st.button("Exit & Resume Later"):
|
71 |
-
submit_feedback(current_index)
|
|
|
|
|
|
|
|
68 |
|
69 |
with col3: # Save & Resume Later button
|
70 |
if st.button("Exit & Resume Later"):
|
71 |
+
submit_feedback(current_index)
|
72 |
+
if st.session_state.current_index == len(data) - 1:
|
73 |
+
st.session_state.completed = True
|
74 |
+
# st.rerun()
|
views/questions_screen.py
CHANGED
@@ -46,6 +46,7 @@ def get_previous_ratings(model_name, query_key, current_index):
|
|
46 |
try:
|
47 |
previous_ratings = response_from_session.model_ratings.get(model_name, {})
|
48 |
except (AttributeError, KeyError):
|
|
|
49 |
previous_ratings = response_from_session["model_ratings"].get(model_name, {})
|
50 |
|
51 |
stored_query_ratings = {}
|
|
|
46 |
try:
|
47 |
previous_ratings = response_from_session.model_ratings.get(model_name, {})
|
48 |
except (AttributeError, KeyError):
|
49 |
+
print("Error in getting previous ratings from session state.")
|
50 |
previous_ratings = response_from_session["model_ratings"].get(model_name, {})
|
51 |
|
52 |
stored_query_ratings = {}
|