Skip to content

Commit

Permalink
fix: only view and log errors if there are any
Browse files Browse the repository at this point in the history
  • Loading branch information
janbritz committed Oct 22, 2024
1 parent 8d7cc91 commit 8398f77
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions questionpy_sdk/webserver/attempt.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ def get_attempt_render_context(
if display_options.general_feedback and attempt.ui.general_feedback:
html, errors = QuestionUIRenderer(attempt.ui.general_feedback, *renderer_args).render()
context["general_feedback"] = html
context["render_errors"]["General Feedback"] = errors
if errors:
context["render_errors"]["General Feedback"] = errors
if display_options.feedback and attempt.ui.specific_feedback:
html, errors = QuestionUIRenderer(attempt.ui.specific_feedback, *renderer_args).render()
context["specific_feedback"] = html
context["render_errors"]["Specific Feedback"] = errors
if errors:
context["render_errors"]["Specific Feedback"] = errors
if display_options.right_answer and attempt.ui.right_answer:
html, errors = QuestionUIRenderer(attempt.ui.right_answer, *renderer_args).render()
context["right_answer"] = html
context["render_errors"]["Right Answer"] = errors
if errors:
context["render_errors"]["Right Answer"] = errors

log_render_errors(context["render_errors"])

Expand Down

0 comments on commit 8398f77

Please sign in to comment.