Sina Media Lab
commited on
Commit
·
0133c15
1
Parent(s):
8cfa676
Updates
Browse files
app.py
CHANGED
@@ -215,14 +215,19 @@ def display_question_with_styles(question_data):
|
|
215 |
</div>
|
216 |
""", unsafe_allow_html=True)
|
217 |
|
218 |
-
# Display options
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
# Display the current question with styles
|
228 |
display_question_with_styles(current_question)
|
@@ -255,10 +260,6 @@ if submit_button and not current_question['answered']:
|
|
255 |
st.session_state.correct_count += 1
|
256 |
st.session_state.module_correct_count[selected_module] += 1
|
257 |
|
258 |
-
# Set answered to true to disable options
|
259 |
-
st.session_state.questions[st.session_state.current_index]['answered'] = True
|
260 |
-
st.session_state.selected_answer = selected_answer
|
261 |
-
|
262 |
# Show correct/incorrect feedback after submission
|
263 |
display_question_with_styles(current_question)
|
264 |
|
|
|
215 |
</div>
|
216 |
""", unsafe_allow_html=True)
|
217 |
|
218 |
+
# Display options with correct/incorrect marking if answered
|
219 |
+
for option in question_data['options']:
|
220 |
+
option_class = ''
|
221 |
+
if question_data['answered']:
|
222 |
+
if option == question_data['correct_answer']:
|
223 |
+
option_class = 'correct'
|
224 |
+
elif option == question_data['selected']:
|
225 |
+
option_class = 'incorrect'
|
226 |
+
st.markdown(f"""
|
227 |
+
<div class="option {option_class}">
|
228 |
+
{option}
|
229 |
+
</div>
|
230 |
+
""", unsafe_allow_html=True)
|
231 |
|
232 |
# Display the current question with styles
|
233 |
display_question_with_styles(current_question)
|
|
|
260 |
st.session_state.correct_count += 1
|
261 |
st.session_state.module_correct_count[selected_module] += 1
|
262 |
|
|
|
|
|
|
|
|
|
263 |
# Show correct/incorrect feedback after submission
|
264 |
display_question_with_styles(current_question)
|
265 |
|