Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only view and log errors if there are any #127

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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