Sina Media Lab
		
	commited on
		
		
					Commit 
							
							·
						
						fedff07
	
1
								Parent(s):
							
							291d95e
								
Updates
Browse files
    	
        app.py
    CHANGED
    
    | @@ -168,7 +168,8 @@ with st.form(key=f'question_form_{st.session_state.current_index}'): | |
| 168 | 
             
                    "Choose an answer:", 
         | 
| 169 | 
             
                    options=current_question['options'], 
         | 
| 170 | 
             
                    key=f"question_{st.session_state.current_index}_options",
         | 
| 171 | 
            -
                    index= | 
|  | |
| 172 | 
             
                )
         | 
| 173 |  | 
| 174 | 
             
                submit_button = st.form_submit_button(label=st.session_state.button_label)
         | 
| @@ -207,7 +208,7 @@ if current_question.get('answered', False): | |
| 207 | 
             
                # Change the button label immediately after showing the solution
         | 
| 208 | 
             
                st.session_state.button_label = "Next Question"
         | 
| 209 |  | 
| 210 | 
            -
            #  | 
| 211 | 
             
            if submit_button and st.session_state.button_label == "Next Question":
         | 
| 212 | 
             
                new_question = generate_new_question(selected_module, modules[selected_module])
         | 
| 213 | 
             
                st.session_state.questions.append(new_question)
         | 
|  | |
| 168 | 
             
                    "Choose an answer:", 
         | 
| 169 | 
             
                    options=current_question['options'], 
         | 
| 170 | 
             
                    key=f"question_{st.session_state.current_index}_options",
         | 
| 171 | 
            +
                    index=current_question['options'].index(current_question['selected']) if current_question['answered'] else None, 
         | 
| 172 | 
            +
                    disabled=current_question['answered']  # Disable if the question has been answered
         | 
| 173 | 
             
                )
         | 
| 174 |  | 
| 175 | 
             
                submit_button = st.form_submit_button(label=st.session_state.button_label)
         | 
|  | |
| 208 | 
             
                # Change the button label immediately after showing the solution
         | 
| 209 | 
             
                st.session_state.button_label = "Next Question"
         | 
| 210 |  | 
| 211 | 
            +
            # Handle switching to the next question on button click
         | 
| 212 | 
             
            if submit_button and st.session_state.button_label == "Next Question":
         | 
| 213 | 
             
                new_question = generate_new_question(selected_module, modules[selected_module])
         | 
| 214 | 
             
                st.session_state.questions.append(new_question)
         | 
