Skip to content

Fix missing overall feedback and score bar on result screen#184

Open
tammets wants to merge 2 commits into
h5p:masterfrom
tammets:local/feedback-section-fix
Open

Fix missing overall feedback and score bar on result screen#184
tammets wants to merge 2 commits into
h5p:masterfrom
tammets:local/feedback-section-fix

Conversation

@tammets
Copy link
Copy Markdown

@tammets tammets commented Apr 24, 2026

Summary

  • Result screen stopped rendering the Overall Feedback text and the score bar after the H5P.Components.ResultScreen refactor (VA-460, 2c3e287).
  • The refactor removed the .feedback-section / .feedback-scorebar / .feedback-text wrapper, but _displayEndGame still tries to fill those selectors via jQuery — both matched zero elements, so the computed scoreString and score bar were silently dropped.
  • This PR re-adds the wrapper inside the result page so the existing append logic has real targets again. No other code paths or styles change.

Fixes #183

Test plan

  • Create a Question Set with 2+ questions and configure Overall Feedback ranges (e.g. 0–49% "Try again", 50–100% "Well done").
  • Leave Display results enabled, complete the quiz, confirm score bar and matching overall feedback text appear on the result screen.
  • Turn Display results off, confirm feedback section and buttons are hidden (the existing else branch at js/questionset.js:748 now actually removes .feedback-section).
  • Per-question list, headers and score summary still render as before.

…nder

The refactor to H5P.Components.ResultScreen stopped emitting the
.feedback-section / .feedback-scorebar / .feedback-text elements, but
_displayEndGame still populates them via jQuery selectors. As a result
the overall feedback text and score bar were computed but never
rendered.

Re-adds the feedback-section wrapper inside the result page so the
existing append logic has real targets again.

Fixes h5p#183
Copilot AI review requested due to automatic review settings April 24, 2026 10:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reintroduces the missing result-screen DOM wrapper needed by legacy jQuery append logic so the Overall Feedback text and score bar render again on the Question Set end screen after the H5P.Components.ResultScreen refactor.

Changes:

  • Add back the .feedback-section container with .feedback-scorebar and .feedback-text inside the result page markup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread js/questionset.js Outdated
Comment on lines +693 to +698
self.$feedbackSection = $(
'<div class="feedback-section">' +
'<div class="feedback-scorebar"></div>' +
'<div class="feedback-text"></div>' +
'</div>'
).appendTo(self.$resultPage);
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.$feedbackSection is assigned here but never read anywhere else in the file. Consider not storing this on self (just append the wrapper), or store it in a local variable if you need it later; otherwise it looks like leftover state and can confuse future maintenance. Also, to match surrounding code (e.g. self.$resultPage, self.$buttonsContainer), consider building the wrapper via $("<div>", { class: ... }) rather than concatenating an HTML string.

Suggested change
self.$feedbackSection = $(
'<div class="feedback-section">' +
'<div class="feedback-scorebar"></div>' +
'<div class="feedback-text"></div>' +
'</div>'
).appendTo(self.$resultPage);
$('<div>', {
class: 'feedback-section',
append: [
$('<div>', { class: 'feedback-scorebar' }),
$('<div>', { class: 'feedback-text' })
],
appendTo: self.$resultPage
});

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overall Feedback and score bar not rendered on Question Set result page

2 participants